From: Junio C Hamano Date: Wed, 7 Jan 2015 21:27:56 +0000 (-0800) Subject: Merge branch 'maint-2.0' into maint-2.1 X-Git-Tag: v2.2.2~7^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c84ac86fc896c108b789b8eb26b169cc0e8088a;p=thirdparty%2Fgit.git Merge branch 'maint-2.0' into maint-2.1 * maint-2.0: is_hfs_dotgit: loosen over-eager match of \u{..47} --- 3c84ac86fc896c108b789b8eb26b169cc0e8088a diff --cc t/t1450-fsck.sh index 426f753fe3,a5589e2da7..6475f10bc5 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@@ -307,60 -287,19 +307,75 @@@ dot-backslash-case .\\\\.GIT\\\\fooba dotgit-case-backslash .git\\\\foobar EOF + test_expect_success 'fsck allows .Ňit' ' + ( + git init not-dotgit && + cd not-dotgit && + echo content >file && + git add file && + git commit -m base && + blob=$(git rev-parse :file) && + printf "100644 blob $blob\t.\\305\\207it" >tree && + tree=$(git mktree err && + test_line_count = 0 err + ) + ' + +# create a static test repo which is broken by omitting +# one particular object ($1, which is looked up via rev-parse +# in the new repository). +create_repo_missing () { + rm -rf missing && + git init missing && + ( + cd missing && + git commit -m one --allow-empty && + mkdir subdir && + echo content >subdir/file && + git add subdir/file && + git commit -m two && + unrelated=$(echo unrelated | git hash-object --stdin -w) && + git tag -m foo tag $unrelated && + sha1=$(git rev-parse --verify "$1") && + path=$(echo $sha1 | sed 's|..|&/|') && + rm .git/objects/$path + ) +} + +test_expect_success 'fsck notices missing blob' ' + create_repo_missing HEAD:subdir/file && + test_must_fail git -C missing fsck +' + +test_expect_success 'fsck notices missing subtree' ' + create_repo_missing HEAD:subdir && + test_must_fail git -C missing fsck +' + +test_expect_success 'fsck notices missing root tree' ' + create_repo_missing HEAD^{tree} && + test_must_fail git -C missing fsck +' + +test_expect_success 'fsck notices missing parent' ' + create_repo_missing HEAD^ && + test_must_fail git -C missing fsck +' + +test_expect_success 'fsck notices missing tagged object' ' + create_repo_missing tag^{blob} && + test_must_fail git -C missing fsck +' + +test_expect_success 'fsck notices ref pointing to missing commit' ' + create_repo_missing HEAD && + test_must_fail git -C missing fsck +' + +test_expect_success 'fsck notices ref pointing to missing tag' ' + create_repo_missing tag && + test_must_fail git -C missing fsck +' + test_done