{"thread":{"id":"65572","subject":"[PATCH] worktree: rename get_worktree_from_repository()","startedAt":"2026-05-01T15:20:15Z","lastAt":"2026-05-01T15:20:15Z","messageCount":1,"participants":["Phillip Wood"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"542552","messageId":"bd48396137f8d1352d11b3bd2dca2848f24a347d.1777648798.git.phillip.wood@dunelm.org.uk","threadId":"65572","inReplyTo":null,"subject":"[PATCH] worktree: rename get_worktree_from_repository()","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2026-05-01T15:20:00Z","receivedAt":"2026-05-01T15:20:15Z","isPatch":true,"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nget_worktree_from_repository() returns a struct worktree that\ndescribes the worktree that the repository argument would operate\non. Since 0f779147602 (worktree: remove \"the_repository\" from\nis_current_worktree(), 2026-03-26) that worktree is always the\n\"current\" worktree. Change the name to get_current_worktee() to\nreflect better what the function does.\n\nSuggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\nBase-Commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0\nPublished-As: https://github.com/phillipwood/git/releases/tag/pw%2Frename-worktree-from-repository%2Fv1\nView-Changes-At: https://github.com/phillipwood/git/compare/94f057755...bd4839613\nFetch-It-Via: git fetch https://github.com/phillipwood/git pw/rename-worktree-from-repository/v1\n\n worktree.c  | 2 +-\n worktree.h  | 2 +-\n wt-status.c | 2 +-\n 3 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/worktree.c b/worktree.c\nindex d874e23b4e..340b4ed777 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -66,7 +66,7 @@ static int is_current_worktree(struct worktree *wt)\n \treturn is_current;\n }\n \n-struct worktree *get_worktree_from_repository(struct repository *repo)\n+struct worktree *get_current_worktree(struct repository *repo)\n {\n \tstruct worktree *wt = xcalloc(1, sizeof(*wt));\n \tchar *gitdir = absolute_pathdup(repo->gitdir);\ndiff --git a/worktree.h b/worktree.h\nindex d19ec29dbb..1075409f9a 100644\n--- a/worktree.h\n+++ b/worktree.h\n@@ -42,7 +42,7 @@ struct worktree **get_worktrees_without_reading_head(void);\n  * Construct a struct worktree corresponding to repo->gitdir and\n  * repo->worktree.\n  */\n-struct worktree *get_worktree_from_repository(struct repository *repo);\n+struct worktree *get_current_worktree(struct repository *repo);\n \n /*\n  * Returns 1 if linked worktrees exist, 0 otherwise.\ndiff --git a/wt-status.c b/wt-status.c\nindex 479ccc3304..c12fca7078 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -1827,7 +1827,7 @@ void wt_status_get_state(struct repository *r,\n \tstruct stat st;\n \tstruct object_id oid;\n \tenum replay_action action;\n-\tstruct worktree *wt = get_worktree_from_repository(r);\n+\tstruct worktree *wt = get_current_worktree(r);\n \n \tif (!stat(git_path_merge_head(r), &st)) {\n \t\twt_status_check_rebase(wt, state);\n-- \n2.54.0.rc1.174.gd833f386ac5.dirty\n\n"}]}