diff options
author | Jeff King <peff@peff.net> | 2023-02-24 11:09:57 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-24 20:32:23 +0300 |
commit | fb64ca526a7c695aa137c2d2577585ddea5cce28 (patch) | |
tree | 3b7a3db7b3d2a7bd1f5be66ecfa73747b4cbe0e2 /t/t1450-fsck.sh | |
parent | 8840069a37e69129ed3c2792ddb172557f98e205 (diff) |
fsck: check index files in all worktrees
We check the index file for the main worktree, but completely ignore the
index files in other worktrees. These should be checked, too, as they
are part of the repository state (and in particular, errors in those
index files may cause repo-wide operations like "git gc" to complain).
Reported-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1450-fsck.sh')
-rwxr-xr-x | t/t1450-fsck.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index de0f6d5e7f..e01a519a69 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -1023,4 +1023,16 @@ test_expect_success 'fsck error on gitattributes with excessive size' ' test_cmp expected actual ' +test_expect_success 'fsck detects problems in worktree index' ' + test_when_finished "git worktree remove -f wt" && + git worktree add wt && + + echo "this will be removed to break the worktree index" >wt/file && + git -C wt add file && + blob=$(git -C wt rev-parse :file) && + remove_object $blob && + + test_must_fail git fsck +' + test_done |