Re: [PATCH v2 1/2] wt-status: avoid passing NULL worktree
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 19, 2026, 20:37 UTC
- Message-ID
- <xmqq4inc4ghg.fsf@gitster.g>
- In-Reply-To
- <xmqqv7fs4jlp.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> In other words, the function is_current_worktree(wt) may not take a > repository and always compute things relative to the_repository, but > once we wean ourselves off of the_repository, we would/should have > repo_is_current_worktree(repo, wt), making is_current_worktree(wt) a > thin wrapper for repo_is_current_worktree(the_repository, wt)?
Eh, in light of 2/2 of this series, since wt knows which repository it belongs to, what I wrote above does not make much sense. Allowing callers to give repo that is different from wt->repo to that function is a potential foot-gun. In other words, isn't is_current_worktree(wt) using the_worktree and not wt->repo a bug already, I have to wonder?