Re: [PATCH 1/3] wt-status: replace uses of the_repository with local repository instances
From: Junio C Hamano <hidden>
Date: 2026-02-02 18:42:56
Karthik Nayak [off-list ref] writes:
One missing information is why is it safe to make this change? If is a repository field, is it holding the same information, is it always defined? ...quoted
@@ -150,11 +150,11 @@ void wt_status_prepare(struct repository *r, struct wt_status *s) s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES; s->use_color = GIT_COLOR_UNKNOWN; s->relative_paths = 1; - s->branch = refs_resolve_refdup(get_main_ref_store(the_repository), + s->branch = refs_resolve_refdup(get_main_ref_store(s->repo), "HEAD", 0, NULL, NULL);Wouldn't it make more sense to use the function argument 'r' here?
quoted
@@ -1723,18 +1723,18 @@ int wt_status_check_rebase(const struct worktree *wt, { struct stat st; - if (!stat(worktree_git_path(the_repository, wt, "rebase-apply"), &st)) { - if (!stat(worktree_git_path(the_repository, wt, "rebase-apply/applying"), &st)) { + if (!stat(worktree_git_path(wt->repo, wt, "rebase-apply"), &st)) { + if (!stat(worktree_git_path(wt->repo, wt, "rebase-apply/applying"), &st)) {In the same file we make a call 'wt_status_check_rebase(NULL, state)', so wouldn't this break?
Good questions. Thanks for a quick review.