]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t1450-fsck.sh
fsck: report non-consecutive duplicate names in trees
[thirdparty/git.git] / t / t1450-fsck.sh
index 02478bc4ece20564a7d5ea27df91cb0695d6e5ec..c43bc6870a86808e771b40f36388be2628c24fd3 100755 (executable)
@@ -234,6 +234,22 @@ test_expect_success 'tree object with duplicate entries' '
        test_i18ngrep "error in tree .*contains duplicate file entries" out
 '
 
+test_expect_success 'tree object with dublicate names' '
+       test_when_finished "remove_object \$blob" &&
+       test_when_finished "remove_object \$tree" &&
+       test_when_finished "remove_object \$badtree" &&
+       blob=$(echo blob | git hash-object -w --stdin) &&
+       printf "100644 blob %s\t%s\n" $blob x.2 >tree &&
+       tree=$(git mktree <tree) &&
+       printf "100644 blob %s\t%s\n" $blob x.1 >badtree &&
+       printf "100644 blob %s\t%s\n" $blob x >>badtree &&
+       printf "040000 tree %s\t%s\n" $tree x >>badtree &&
+       badtree=$(git mktree <badtree) &&
+       test_must_fail git fsck 2>out &&
+       test_i18ngrep "$badtree" out &&
+       test_i18ngrep "error in tree .*contains duplicate file entries" out
+'
+
 test_expect_success 'unparseable tree object' '
        test_oid_cache <<-\EOF &&
        junk sha1:twenty-bytes-of-junk