From: Phillip Wood <phillip.wood@dunelm.org.uk>
get_worktree_from_repository() returns a struct worktree that describes the worktree that the repository argument would operate on. Since 0f779147602 (worktree: remove "the_repository" from is_current_worktree(), 2026-03-26) that worktree is always the "current" worktree. Change the name to get_current_worktee() to reflect better what the function does.
Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> --- Base-Commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0 Published-As: https://github.com/phillipwood/git/releases/tag/pw%2Frename-worktree-from-repository%2Fv1 View-Changes-At: https://github.com/phillipwood/git/compare/94f057755...bd4839613 Fetch-It-Via: git fetch https://github.com/phillipwood/git pw/rename-worktree-from-repository/v1
worktree.c | 2 +- worktree.h | 2 +- wt-status.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Show changes to 3 files +3 −3
worktree.c, worktree.h, wt-status.c
diff --git a/worktree.c b/worktree.c index d874e23b4e..340b4ed777 100644 --- a/worktree.c +++ b/worktree.c @@ -66,7 +66,7 @@ static int is_current_worktree(struct worktree *wt) return is_current; } -struct worktree *get_worktree_from_repository(struct repository *repo) +struct worktree *get_current_worktree(struct repository *repo) { struct worktree *wt = xcalloc(1, sizeof(*wt)); char *gitdir = absolute_pathdup(repo->gitdir); diff --git a/worktree.h b/worktree.h index d19ec29dbb..1075409f9a 100644 --- a/worktree.h +++ b/worktree.h @@ -42,7 +42,7 @@ struct worktree **get_worktrees_without_reading_head(void); * Construct a struct worktree corresponding to repo->gitdir and * repo->worktree. */ -struct worktree *get_worktree_from_repository(struct repository *repo); +struct worktree *get_current_worktree(struct repository *repo); /* * Returns 1 if linked worktrees exist, 0 otherwise. diff --git a/wt-status.c b/wt-status.c index 479ccc3304..c12fca7078 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1827,7 +1827,7 @@ void wt_status_get_state(struct repository *r, struct stat st; struct object_id oid; enum replay_action action; - struct worktree *wt = get_worktree_from_repository(r); + struct worktree *wt = get_current_worktree(r); if (!stat(git_path_merge_head(r), &st)) { wt_status_check_rebase(wt, state);
-- 2.54.0.rc1.174.gd833f386ac5.dirty