]> git.ipfire.org Git - thirdparty/git.git/commitdiff
worktree: rename get_worktree_from_repository()
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Fri, 1 May 2026 15:20:00 +0000 (16:20 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 May 2026 22:02:45 +0000 (07:02 +0900)
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>
worktree.c
worktree.h
wt-status.c

index d874e23b4e158a0b6351d2a5b0773a3bd57b1978..340b4ed777cc25178c7dde662f983c60febd8912 100644 (file)
@@ -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);
index d19ec29dbb048985c6cb3f26bb9eefab38e19801..1075409f9aa2b71db1b2f03b1bd3ad66a0cc4e84 100644 (file)
@@ -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.
index 479ccc3304bc33bfd893aa3909261a43c088015a..c12fca707812990153da6e393f5a8cc111944ec8 100644 (file)
@@ -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);