# Re: \[PATCH\] fsck: avoid misleading variable name

- From: Jeff King \<hidden\>
- Date: 2023-06-29 19:12:50 
- List: git
- Page: https://ratatoskr.run/git/2023/06/7972053
- Thread: https://ratatoskr.run/git/2023/06/7972048/t.md

```text
On Thu, Jun 29, 2023 at 02:13:33PM -0400, Eric Sunshine wrote:

> From: Eric Sunshine <redacted>
> 
> 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.

This looks good to me. Thanks for following up!

-Peff
```
