Signed-off-by: Elijah Newren <new...@gmail.com>
---
 t/t1450-fsck.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index cb4b66e29d..fa94c59458 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -102,6 +102,33 @@ test_expect_success 'HEAD link pointing at a funny place' '
        grep "HEAD points to something strange" out
 '
 
+test_expect_failure 'other worktree HEAD link pointing at a funny object' '
+       test_when_finished "rm -rf .git/worktrees" &&
+       mkdir -p .git/worktrees/other &&
+       echo 0000000000000000000000000000000000000000 
>.git/worktrees/other/HEAD &&
+       test_must_fail git fsck 2>out &&
+       cat out &&
+       grep "worktrees/other/HEAD: detached HEAD points" out
+'
+
+test_expect_failure 'other worktree HEAD link pointing at missing object' '
+       test_when_finished "rm -rf .git/worktrees" &&
+       mkdir -p .git/worktrees/other &&
+       echo "Contents missing from repo" | git hash-object --stdin 
>.git/worktrees/other/HEAD &&
+       test_must_fail git fsck 2>out &&
+       cat out &&
+       grep "worktrees/other/HEAD: invalid sha1 pointer" out
+'
+
+test_expect_failure 'other worktree HEAD link pointing at a funny place' '
+       test_when_finished "rm -rf .git/worktrees" &&
+       mkdir -p .git/worktrees/other &&
+       echo "ref: refs/funny/place" >.git/worktrees/other/HEAD &&
+       test_must_fail git fsck 2>out &&
+       cat out &&
+       grep "worktrees/other/HEAD points to something strange" out
+'
+
 test_expect_success 'email without @ is okay' '
        git cat-file commit HEAD >basis &&
        sed "s/@/AT/" basis >okay &&
-- 
2.16.1.75.gc01c8fdd7d

Reply via email to