Skip to content

Commit 45e2ef2

Browse files
bk2204gitster
authored andcommitted
t4027: make hash-size independent
Instead of hard-coding the length of an object ID, look this value up using the translation tables. Similarly, compute input data for invalid submodule entries using the tables as well. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 79b0edc commit 45e2ef2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

t/t4027-diff-submodule.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ test_description='difference in submodules'
66
. "$TEST_DIRECTORY"/diff-lib.sh
77

88
test_expect_success setup '
9+
test_oid_init &&
910
test_tick &&
1011
test_create_repo sub &&
1112
(
@@ -36,7 +37,8 @@ test_expect_success setup '
3637
'
3738

3839
test_expect_success 'git diff --raw HEAD' '
39-
git diff --raw --abbrev=40 HEAD >actual &&
40+
hexsz=$(test_oid hexsz) &&
41+
git diff --raw --abbrev=$hexsz HEAD >actual &&
4042
test_cmp expect actual
4143
'
4244

@@ -245,23 +247,21 @@ test_expect_success 'git diff (empty submodule dir)' '
245247
'
246248

247249
test_expect_success 'conflicted submodule setup' '
248-
249-
# 39 efs
250-
c=fffffffffffffffffffffffffffffffffffffff &&
250+
c=$(test_oid ff_1) &&
251251
(
252252
echo "000000 $ZERO_OID 0 sub" &&
253253
echo "160000 1$c 1 sub" &&
254254
echo "160000 2$c 2 sub" &&
255255
echo "160000 3$c 3 sub"
256256
) | git update-index --index-info &&
257-
echo >expect.nosub '\''diff --cc sub
257+
echo >expect.nosub "diff --cc sub
258258
index 2ffffff,3ffffff..0000000
259259
--- a/sub
260260
+++ b/sub
261261
@@@ -1,1 -1,1 +1,1 @@@
262-
- Subproject commit 2fffffffffffffffffffffffffffffffffffffff
263-
-Subproject commit 3fffffffffffffffffffffffffffffffffffffff
264-
++Subproject commit 0000000000000000000000000000000000000000'\'' &&
262+
- Subproject commit 2$c
263+
-Subproject commit 3$c
264+
++Subproject commit $ZERO_OID" &&
265265
266266
hh=$(git rev-parse HEAD) &&
267267
sed -e "s/$ZERO_OID/$hh/" expect.nosub >expect.withsub

0 commit comments

Comments
 (0)