From: Karthik Nayak Date: Wed, 04 Feb 2026 10:18:05 GMT Subject: Re: [PATCH 3/3] wt-status: use hash_algo from local repository instead of global the_hash_algo Message-ID: In-Reply-To: <20260202190458.81443-1-shreyanshpaliwalcmsmn@gmail.com> Shreyansh Paliwal writes: >> > 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. > Understandable. > 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. > Yeah, my intent wasn't to have all the cleanup done in this series, but rather to ensure we have enough information presented. You've already explained the reason. It would be great if you could add this information to the cover. > Though I require some guidance on the preferred approach for handling > comment_line_str and DEFAULT_ABBREV going forward. > Happy to help out. Generally using an RFC patch series generally has the best outcome, since it provides material to base discussions on. > Thanks for reviewing. > > Best, > Shreyansh > > [1]- https://lore.kernel.org/git/5e56e1cc4172cfff9e917a068184e102aa70bf1d.1769256839.git.belkid98@gmail.com/t/#u