diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-05-14 14:39:43 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-05-14 14:39:44 -0700 |
commit | 0498840b3517b8dcc1376a05b92c10c9e5b2e4ad (patch) | |
tree | 73e2cf45a2dde6ce6d77f3d6ad95889c1a978d87 /t/t1450-fsck.sh | |
parent | f4507cea2481e81eacfcc706dfc6ec09f38ae731 (diff) | |
parent | 9068cfb20f5699fd639a559af14affaefe43a812 (diff) | |
download | git-0498840b3517b8dcc1376a05b92c10c9e5b2e4ad.tar.gz |
Merge branch 'rs/fsck-duplicate-names-in-trees'
"git fsck" ensures that the paths recorded in tree objects are
sorted and without duplicates, but it failed to notice a case where
a blob is followed by entries that sort before a tree with the same
name. This has been corrected.
* rs/fsck-duplicate-names-in-trees:
fsck: report non-consecutive duplicate names in trees
Diffstat (limited to 't/t1450-fsck.sh')
-rwxr-xr-x | t/t1450-fsck.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 449ebc5657..91a6e34f38 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -257,6 +257,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 |