t2203: avoid hard-coded object ID values
authorbrian m. carlson <sandals@crustytoothpaste.net>
Fri, 28 Jun 2019 22:59:28 +0000 (22:59 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Jul 2019 20:28:19 +0000 (13:28 -0700)
In order to make this test work with multiple hash algorithms, compute
the object ID used in this test instead of hard-coding it.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2203-add-intent.sh
index 68e54d5c4420092e481ae1324d419f5e5ec0c8ab..5bbe8dcce40160af8ad1d4c5b0d61a404be7552c 100755 (executable)
@@ -247,12 +247,14 @@ test_expect_success 'diff-files/diff-cached shows ita as new/not-new files' '
 test_expect_success '"diff HEAD" includes ita as new files' '
        git reset --hard &&
        echo new >new-ita &&
+       oid=$(git hash-object new-ita) &&
+       oid=$(git rev-parse --short $oid) &&
        git add -N new-ita &&
        git diff HEAD >actual &&
-       cat >expected <<-\EOF &&
+       cat >expected <<-EOF &&
        diff --git a/new-ita b/new-ita
        new file mode 100644
-       index 0000000..3e75765
+       index 0000000..$oid
        --- /dev/null
        +++ b/new-ita
        @@ -0,0 +1 @@