diff --git a/t/t1600-index.sh b/t/t1600-index.sh index 98c5a83db7..2f792bb8ff 100755 --- a/t/t1600-index.sh +++ b/t/t1600-index.sh @@ -68,6 +68,9 @@ test_expect_success 'out of bounds index.version issues warning' ' test_expect_success 'index.skipHash config option' ' rm -f .git/index && git -c index.skipHash=true add a && + test_trailing_hash .git/index >hash && + echo $(test_oid zero) >expect && + test_cmp expect hash && git fsck && test_commit start && @@ -76,6 +79,8 @@ test_expect_success 'index.skipHash config option' ' git -C sub config index.skipHash true && >sub/file && git -C sub add a && + test_trailing_hash .git/modules/sub/index >hash && + test_cmp expect hash && git -C sub fsck ' diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 796093a7b3..60308843f8 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1875,3 +1875,11 @@ test_cmp_config_output () { sort config-actual >sorted-actual && test_cmp sorted-expect sorted-actual } + +# Given a filename, extract its trailing hash as a hex string +test_trailing_hash () { + local file="$1" && + tail -c $(test_oid rawsz) "$file" | + test-tool hexdump | + sed "s/ //g" +}