Subject: Re: [PATCH 1/3] wt-status: replace uses of the_repository with local repository instances

From: Phillip Wood <[email-masked]>
Date: Tue, 3 Feb 2026 11:06:09 +0000

On 03/02/2026 09:53, Shreyansh Paliwal wrote:
>> 
>> 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

> 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
>