@matheusbsbs / matheus-bagliano / commits / 45e2ef2b1d
Fork 0

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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Oct 28, 2019 at 00:59 UTC 45e2ef2b1d7093e535a0c3963e64a0c212aace54
1 file changed +8 -8
t/t4027-diff-submodule.sh
+8 -8
@@ -6,6 +6,7 @@ test_description='difference in submodules'
6 . "$TEST_DIRECTORY"/diff-lib.sh
7
8 test_expect_success setup '
9 + test_oid_init &&
10 test_tick &&
11 test_create_repo sub &&
12 (
@@ -36,7 +37,8 @@ test_expect_success setup '
37 '
38
39 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 &&
42 test_cmp expect actual
43 '
44
@@ -245,23 +247,21 @@ test_expect_success 'git diff (empty submodule dir)' '
247 '
248
249 test_expect_success 'conflicted submodule setup' '
248 -
249 - # 39 efs
250 - c=fffffffffffffffffffffffffffffffffffffff &&
250 + c=$(test_oid ff_1) &&
251 (
252 echo "000000 $ZERO_OID 0 sub" &&
253 echo "160000 1$c 1 sub" &&
254 echo "160000 2$c 2 sub" &&
255 echo "160000 3$c 3 sub"
256 ) | git update-index --index-info &&
257 - echo >expect.nosub '\''diff --cc sub
257 + echo >expect.nosub "diff --cc sub
258 index 2ffffff,3ffffff..0000000
259 --- a/sub
260 +++ b/sub
261 @@@ -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" &&
265
266 hh=$(git rev-parse HEAD) &&
267 sed -e "s/$ZERO_OID/$hh/" expect.nosub >expect.withsub