From: Phillip Wood Date: Mon, 16 Feb 2026 16:18:08 GMT Subject: [PATCH 0/2] worktree_git_path(): remove repository argument Message-ID: In-Reply-To: From: Phillip Wood On 14/02/2026 14:30, Phillip Wood wrote: > > I think that we should add a new function > > struct worktree *get_current_worktree(struct repository*); > > to worktree.c that constructs a struct worktree using repo->gitdir etc. > The worktree id is the last path component of repo->gitdir when the > repo->gitdir and repo->commondir differ, otherwise it is NULL. Then we > can use that function to get the current worktree rather than passing > NULL when we call wt_status_check_{rebase,bisect} from > wt_status_get_state(). Here's what that looks like, the first patch adds get_worktree_from_repository() and uses it to avoid passing a NULL worktree to worktree_git_path(). The second patch then removes the repository argument from that function and always uses wt->repo instead. Shreyansh - I think your patches to clean up wt-status.c can probably proceed separately to these if you remove the changes to wt_status_check_{bisect,rebase}(). Base-Commit: 852829b3dd2fe4e7c7fc4d8badde644cf1b66c74 Published-As: https://github.com/phillipwood/git/releases/tag/pw%2Fget-current-worktree%2Fv1 View-Changes-At: https://github.com/phillipwood/git/compare/852829b3d...23b8a355b Fetch-It-Via: git fetch https://github.com/phillipwood/git pw/get-current-worktree/v1 Phillip Wood (2): wt-status: avoid passing NULL worktree path: remove repository argument from worktree_git_path() builtin/fsck.c | 2 +- builtin/worktree.c | 4 ++-- path.c | 9 ++++----- path.h | 8 +++----- revision.c | 2 +- worktree.c | 22 +++++++++++++++++++++- worktree.h | 5 ++++- wt-status.c | 29 +++++++++++++++++++---------- 8 files changed, 55 insertions(+), 26 deletions(-) -- 2.52.0.362.g884e03848a9