From: Shreyansh Paliwal Date: Thu, 05 Feb 2026 10:13:10 GMT Subject: [PATCH V2 0/3] wt-status: reduce reliance on global state Message-ID: <20260205101524.125452-1-shreyanshpaliwalcmsmn@gmail.com> In-Reply-To: <20260131190106.389289-1-shreyanshpaliwalcmsmn@gmail.com> 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 worktree. In patch 1/3, replace direct uses of the_repository with repository instances already available in local structs. In patch 2/3, update function parameters and calls to pass struct repository or struct wt_status explicitly where no local repository access was available. In patch 3/3, replace remaining uses of the global the_hash_algo with the hash algorithm stored in the respective repository instance. These changes remove all direct uses of the_repository and the_hash_algo from wt-status.c and reduce its dependence on global state. The 'USE_THE_REPOSITORY_VARIABLE' macro cannot yet be removed, since these patches only eliminate direct uses of the_repository and the_hash_algo, while other global variables are still referenced. 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]. * comment_line_str and DEFAULT_ABBREV, these both still are used in wt-status.c but they dont have any equivalent local instances. [1]- https://lore.kernel.org/git/5e56e1cc4172cfff9e917a068184e102aa70bf1d.1769256839.git.belkid98@gmail.com/t/#u Shreyansh Paliwal (3): wt-status: replace uses of the_repository with local repository instances wt-status: pass struct repository and wt_status through function parameters wt-status: use hash_algo from local repository instead of global the_hash_algo branch.c | 2 +- worktree.c | 2 +- wt-status.c | 85 +++++++++++++++++++++++++++-------------------------- wt-status.h | 5 ++-- 4 files changed, 48 insertions(+), 46 deletions(-) -- 2.52.0