[Outreachy PATCH] wt-status: use the repository the status already has

flat view

From: Okhuomon Ajayi <hidden>
Date: 2026-11-01 06:40:13
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help