@@ -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
'
@@ -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"
+}