]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t4027: make hash-size independent
authorbrian m. carlson <sandals@crustytoothpaste.net>
Mon, 28 Oct 2019 00:59:01 +0000 (00:59 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Oct 2019 02:34:58 +0000 (11:34 +0900)
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>
t/t4027-diff-submodule.sh

index 9aa8e2b39b45a6c2b5ec48a9d98b94831edb2caa..e29deaf4a509523b00e6bf9ac5d2436957a1b022 100755 (executable)
@@ -6,6 +6,7 @@ test_description='difference in submodules'
 . "$TEST_DIRECTORY"/diff-lib.sh
 
 test_expect_success setup '
+       test_oid_init &&
        test_tick &&
        test_create_repo sub &&
        (
@@ -36,7 +37,8 @@ test_expect_success setup '
 '
 
 test_expect_success 'git diff --raw HEAD' '
-       git diff --raw --abbrev=40 HEAD >actual &&
+       hexsz=$(test_oid hexsz) &&
+       git diff --raw --abbrev=$hexsz HEAD >actual &&
        test_cmp expect actual
 '
 
@@ -245,23 +247,21 @@ test_expect_success 'git diff (empty submodule dir)' '
 '
 
 test_expect_success 'conflicted submodule setup' '
-
-       # 39 efs
-       c=fffffffffffffffffffffffffffffffffffffff &&
+       c=$(test_oid ff_1) &&
        (
                echo "000000 $ZERO_OID 0        sub" &&
                echo "160000 1$c 1      sub" &&
                echo "160000 2$c 2      sub" &&
                echo "160000 3$c 3      sub"
        ) | git update-index --index-info &&
-       echo >expect.nosub '\''diff --cc sub
+       echo >expect.nosub "diff --cc sub
 index 2ffffff,3ffffff..0000000
 --- a/sub
 +++ b/sub
 @@@ -1,1 -1,1 +1,1 @@@
-- Subproject commit 2fffffffffffffffffffffffffffffffffffffff
- -Subproject commit 3fffffffffffffffffffffffffffffffffffffff
-++Subproject commit 0000000000000000000000000000000000000000'\'' &&
+- Subproject commit 2$c
+ -Subproject commit 3$c
+++Subproject commit $ZERO_OID" &&
 
        hh=$(git rev-parse HEAD) &&
        sed -e "s/$ZERO_OID/$hh/" expect.nosub >expect.withsub