worktree: rename get_worktree_from_repository()
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood committed
May 1, 2026 at 16:20 UTC
8547908eb30d8b3ee074081f89fa29c6d6d077c2
3 files changed
+3
-3
worktree.c
+1
-1
@@ -66,7 +66,7 @@ static int is_current_worktree(struct worktree *wt)
66
return is_current;
67
}
68
69
-struct worktree *get_worktree_from_repository(struct repository *repo)
69
+struct worktree *get_current_worktree(struct repository *repo)
70
{
71
struct worktree *wt = xcalloc(1, sizeof(*wt));
72
char *gitdir = absolute_pathdup(repo->gitdir);
worktree.h
+1
-1
@@ -42,7 +42,7 @@ struct worktree **get_worktrees_without_reading_head(void);
42
* Construct a struct worktree corresponding to repo->gitdir and
43
* repo->worktree.
44
*/
45
-struct worktree *get_worktree_from_repository(struct repository *repo);
45
+struct worktree *get_current_worktree(struct repository *repo);
46
47
/*
48
* Returns 1 if linked worktrees exist, 0 otherwise.
wt-status.c
+1
-1
@@ -1827,7 +1827,7 @@ void wt_status_get_state(struct repository *r,
1827
struct stat st;
1828
struct object_id oid;
1829
enum replay_action action;
1830
- struct worktree *wt = get_worktree_from_repository(r);
1830
+ struct worktree *wt = get_current_worktree(r);
1831
1832
if (!stat(git_path_merge_head(r), &st)) {
1833
wt_status_check_rebase(wt, state);