Re: [PATCH 3/3] wt-status: use hash_algo from local repository instead of global the_hash_algo
- From
Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
- Date
- Feb 2, 2026, 19:03 UTC
- Message-ID
- <20260202190458.81443-1-shreyanshpaliwalcmsmn@gmail.com>
- In-Reply-To
- <CAOLa=ZT6ReeaPvJiNh967Sn2p3K8sQKEOOMJ+6-7ZdFO+wr8mg@mail.gmail.com>
Show 12 quoted lines
> > 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/5e56e1cc4172cfff9e917a068184e102aa70bf1d.1769256839.git.belkid98@gmail.com/t/#u