Subject: Re: [PATCH 3/3] wt-status: use hash_algo from local repository instead of global the_hash_algo

From: Shreyansh Paliwal <[email-masked]>
Date: Tue, 3 Feb 2026 00:33:15 +0530

> > wt-status.c uses the global the_hash_algo even though a repository
> > instance is already available via struct repository *r.
> >
> > Replace uses of the_hash_algo with the hash algorithm stored in the
> > associated repository (r->hash_algo).
> >
> > This removes another dependency on global state and keeps wt-status
> > consistent with local repository usage.
> >
> 
> One final question is, does this mean we can remove
> `USE_THE_REPOSITORY_VARIABLE` after these changes? If not, why?

We cannot remove `USE_THE_REPOSITORY_VARIABLE` yet, because the changes done only
remove the direct use of the_hash_algo and the_repository,
but 'USE_THE_REPOSITORY_VARIABLE' is for all the global variables
that are still in use.

In particular wt-status.c still relies on the following globals,

* core_apply_sparse_checkout, this is already being addressed in an
ongoing patch series [1], so I intentionally did not modify it.

* comment_line_str and DEFAULT_ABBREV, these both still are used in
wt-status.c but they dont have any local instance in wt-status.c,
or in any other form.

Removing these would require a wider refactoring (adding in struct wt_status,
adding helper functions etc) and I believe is better handled as a separate patch series.

Though I require some guidance on the preferred approach for handling
comment_line_str and DEFAULT_ABBREV going forward.

Thanks for reviewing.

Best,
Shreyansh

[1]- https://lore.kernel.org/git/[email-masked]/t/#u