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>
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);
* 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.
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);