Subject: Re: [PATCH v4 0/3] wt-status: reduce reliance on global state

From: Shreyansh Paliwal <[email-masked]>
Date: Wed, 18 Feb 2026 22:18:14 +0530

> On 17/02/2026 17:29, Shreyansh Paliwal wrote:
> > In wt-status.c code still relies on some global variables, including
> > the_repository and the_hash_algo, even in cases where a repository
> > instance is already available via struct wt_status or struct repository.
> >
> > In patch 1/3, update function parameters and callers to pass struct
> > repository where no local repository access was available.
>
> This breaks the build when running "make DEVELOPER=1"
>
> wt-status.c: In function ‘count_stash_entries’:
> wt-status.c:1011:51: error: unused parameter ‘r’ [-Werror=unused-parameter]
>   1011 | static int count_stash_entries(struct repository *r)
>        |                                ~~~~~~~~~~~~~~~~~~~^
> wt-status.c: In function ‘read_line_from_git_path’:
> wt-status.c:1314:57: error: unused parameter ‘r’ [-Werror=unused-parameter]
>   1314 | static char *read_line_from_git_path(struct repository *r,
> const char *filename)
>        |                                      ~~~~~~~~~~~~~~~~~~~^
> wt-status.c: In function ‘abbrev_oid_in_line’:
> wt-status.c:1377:51: error: unused parameter ‘r’ [-Werror=unused-parameter]
>   1377 | static void abbrev_oid_in_line(struct repository *r, struct
> strbuf *line)
>        |                                ~~~~~~~~~~~~~~~~~~~^
>
> It would be better to use the new argument to replace "the_repository"
> in this patch. There aren't that many so the patch is still a manageable
> size.

Thanks for catching that. I ran the build and test suite after all the commits
at once so it got overlooked.

> > In patch 2/3, replace direct uses of the_repository with repository
> > instances already available in local structs.
> >
> > In patch 3/3, replace remaining uses of the global the_hash_algo with the
> > hash algorithm stored in the respective repository instance.
>
> These both look good, though I think the commit message for the second
> patch could be reflowed to give a more consistent line length.

I will send a revised version. Thanks.

Best,
Shreyansh