t1011: abstract away SHA-1-specific constants
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sun, 25 Mar 2018 19:20:46 +0000 (19:20 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Mar 2018 22:10:48 +0000 (15:10 -0700)
Adjust the test so that it computes the expected hash value dynamically
instead of relying on a hard-coded hash. Hoist some code earlier in the
test to make this possible.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1011-read-tree-sparse-checkout.sh
index c167f606ca7b8c1628ac8d00507d50f032278730..0c6f48f3024c81de765a8acb489e2d5e3ec42a56 100755 (executable)
@@ -15,8 +15,11 @@ test_description='sparse checkout tests
 . "$TEST_DIRECTORY"/lib-read-tree.sh
 
 test_expect_success 'setup' '
+       test_commit init &&
+       echo modified >>init.t &&
+
        cat >expected <<-EOF &&
-       100644 77f0ba1734ed79d12881f81b36ee134de6a3327b 0       init.t
+       100644 $(git hash-object init.t) 0      init.t
        100644 $EMPTY_BLOB 0    sub/added
        100644 $EMPTY_BLOB 0    sub/addedtoo
        100644 $EMPTY_BLOB 0    subsub/added
@@ -28,8 +31,6 @@ test_expect_success 'setup' '
        H subsub/added
        EOF
 
-       test_commit init &&
-       echo modified >>init.t &&
        mkdir sub subsub &&
        touch sub/added sub/addedtoo subsub/added &&
        git add init.t sub/added sub/addedtoo subsub/added &&