aboutsummaryrefslogtreecommitdiffstats
path: root/branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-03-05 10:37:43 -0800
committerJunio C Hamano <gitster@pobox.com>2025-03-05 10:37:43 -0800
commitfeffb34257ee8eef18cc6a3a5a4f01d40720bda1 (patch)
tree02842b3ce862be72ad6a0ace18aca0fa1a4f1ca7 /branch.c
parentGit 2.49-rc1 (diff)
parentpath: adjust last remaining users of `the_repository` (diff)
downloadgit-feffb34257ee8eef18cc6a3a5a4f01d40720bda1.tar.gz
git-feffb34257ee8eef18cc6a3a5a4f01d40720bda1.zip
Merge branch 'ps/path-sans-the-repository'
The path.[ch] API takes an explicit repository parameter passed throughout the callchain, instead of relying on the_repository singleton instance. * ps/path-sans-the-repository: path: adjust last remaining users of `the_repository` environment: move access to "core.sharedRepository" into repo settings environment: move access to "core.hooksPath" into repo settings repo-settings: introduce function to clear struct path: drop `git_path()` in favor of `repo_git_path()` rerere: let `rerere_path()` write paths into a caller-provided buffer path: drop `git_common_path()` in favor of `repo_common_path()` worktree: return allocated string from `get_worktree_git_dir()` path: drop `git_path_buf()` in favor of `repo_git_path_replace()` path: drop `git_pathdup()` in favor of `repo_git_path()` path: drop unused `strbuf_git_path()` function path: refactor `repo_submodule_path()` family of functions submodule: refactor `submodule_to_gitdir()` to accept a repo path: refactor `repo_worktree_path()` family of functions path: refactor `repo_git_path()` family of functions path: refactor `repo_common_path()` family of functions
Diffstat (limited to 'branch.c')
-rw-r--r--branch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/branch.c b/branch.c
index 77716966fe..91297d55ac 100644
--- a/branch.c
+++ b/branch.c
@@ -397,7 +397,7 @@ static void prepare_checked_out_branches(void)
worktrees = get_worktrees();
while (worktrees[i]) {
- char *old;
+ char *old, *wt_gitdir;
struct wt_status_state state = { 0 };
struct worktree *wt = worktrees[i++];
struct string_list update_refs = STRING_LIST_INIT_DUP;
@@ -437,7 +437,8 @@ static void prepare_checked_out_branches(void)
}
wt_status_state_free_buffers(&state);
- if (!sequencer_get_update_refs_state(get_worktree_git_dir(wt),
+ wt_gitdir = get_worktree_git_dir(wt);
+ if (!sequencer_get_update_refs_state(wt_gitdir,
&update_refs)) {
struct string_list_item *item;
for_each_string_list_item(item, &update_refs) {
@@ -448,6 +449,8 @@ static void prepare_checked_out_branches(void)
}
string_list_clear(&update_refs, 1);
}
+
+ free(wt_gitdir);
}
free_worktrees(worktrees);