Re: [PATCH 1/3] wt-status: replace uses of the_repository with local repository instances
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Feb 3, 2026, 11:06 UTC
- Message-ID
- <da3221b6-f724-49ea-99e3-9baed38d5bd3@gmail.com>
- In-Reply-To
- <20260203095446.10971-1-shreyanshpaliwalcmsmn@gmail.com>
On 03/02/2026 09:53, Shreyansh Paliwal wrote:
Show 15 quoted lines
>> >> Clarification. This function is like an initializer for the struct >> wt_status instance at 's', so it has to take both "struct repository" >> parameter, but what I meant was other wt_status_foo() functions that >> take both r and s as parameters. Once s has been initialized and >> s->repo becomes valid, passing r as a separate parameter, as if you >> can feed a different instance of "struct repo", becomes confusing >> and a source of bugs. > > Actually wt_status_prepare() is the only function which is taking both > struct wt_status *s and struct repository *r, because it has to initialize > 's' with the help of 'r'. > But all the other wt_status_.. helper functions only take one of the following, > i.e. either they take struct wt_status *s which is fine, or they take > struct repository *r.
You're correct, but I had the same reaction as Junio initially as I was confused by the functions that take a "struct repository" and "struct wt_status_state" which does not contain a repository, but at first glance looks a lot like "struct wt_status" which does.
Thanks
Phillip
Show 10 quoted lines
> If we trace the callers of the functions with struct repository *r, > they are either being called in wt_status.c in which s->repo is being passed > as a parameter at the end so it shouldn't cause any issues, > and for any other file callers, the_repository is being passed, > so to remove struct repository *r, we would have to setup struct wt_status > in those files as well. > > Best, > Shreyansh >