diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2023-06-29 21:13:33 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-29 23:58:57 +0300 |
commit | 6e6a529b573398f0a8828551cf04dafb4f084c9a (patch) | |
tree | e637673d12cf8b944bbd29ec212d5931cffb092a /t/t1450-fsck.sh | |
parent | 8d3e7eac529b42319622692028b45670bdff8835 (diff) |
fsck: avoid misleading variable name
When reporting a problem, `git fsck` emits a message such as:
missing blob 1234abcd (:file)
However, this can be ambiguous when the problem is detected in the index
of a worktree other than the one in which `git fsck` was invoked. To
address this shortcoming, 592ec63b38 (fsck: mention file path for index
errors, 2023-02-24) enhanced the output to mention the path of the index
when the problem is detected in some other worktree:
missing blob 1234abcd (.git/worktrees/wt/index:file)
Unfortunately, the variable in fsck_index() which controls whether the
index path should be shown is misleadingly named "is_main_index" which
can be misunderstood as referring to the main worktree (i.e. the one
housing the .git/ repository) rather than to the current worktree (i.e.
the one in which `git fsck` was invoked). Avoid such potential confusion
by choosing a name more reflective of its actual purpose.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Acked-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 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 82c92de7ca..849f577cf6 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -1039,9 +1039,9 @@ test_expect_success 'fsck detects problems in worktree index' ' test_cmp expect actual ' -test_expect_success 'fsck reports problems in main index without filename' ' +test_expect_success 'fsck reports problems in current worktree index without filename' ' test_when_finished "rm -f .git/index && git read-tree HEAD" && - echo "this object will be removed to break the main index" >file && + echo "this object will be removed to break current worktree index" >file && git add file && blob=$(git rev-parse :file) && remove_object $blob && |