[Outreachy PATCH] wt-status: use the repository the status already has
- From
- Okhuomon Ajayi <okhuomonajayi54@gmail.com>
- Date
- Nov 1, 2026, 06:39 UTC
- Message-ID
- <20261101063951.85427-1-okhuomonajayi54@gmail.com>
wt_longstatus_print_verbose() sets up the work tree of the_repository, even though its wt_status already names the repository in s->repo. wt_status_check_sparse_checkout() receives a repository, but reads the sparse-checkout setting from the_repository.
Use s->repo and r instead.
Keep USE_THE_REPOSITORY_VARIABLE because DEFAULT_ABBREV, which is still used in this file, expands to the global default_abbrev.
Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com> --- wt-status.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/wt-status.c b/wt-status.c index 238bb48643..5bd1ecee10 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1208,7 +1208,7 @@ static void wt_longstatus_print_verbose(struct wt_status *s) status_printf_ln(s, c, "--------------------------------------------------"); status_printf_ln(s, c, _("Changes not staged for commit:")); - setup_work_tree(the_repository); + setup_work_tree(s->repo); rev.diffopt.a_prefix = "i/"; rev.diffopt.b_prefix = "w/"; run_diff_files(&rev, 0); @@ -1895,7 +1895,7 @@ static void wt_status_check_sparse_checkout(struct repository *r, { int skip_worktree = 0; int i; - struct repo_config_values *cfg = repo_config_values(the_repository); + struct repo_config_values *cfg = repo_config_values(r); if (!cfg->apply_sparse_checkout || r->index->cache_nr == 0) { base-commit: 50fe5cc63f9cd6e89b87a2c9ccf96a444f4cfdb7
-- 2.56.0