summaryrefslogtreecommitdiff
path: root/builtin/commit.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 /builtin/commit.c
parent6a64ac7b014fa2cfa7a69af3c253bcd53a94b428 (diff)
parent028f618658e34230e1d65678f14b6876e0f9856d (diff)
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 'builtin/commit.c')
-rw-r--r--builtin/commit.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 9fb405dd4a..2f45968222 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -352,6 +352,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
struct pathspec pathspec;
int refresh_flags = REFRESH_QUIET;
const char *ret;
+ char *path = NULL;
if (is_status)
refresh_flags |= REFRESH_UNMERGED;
@@ -524,9 +525,9 @@ static const char *prepare_index(const char **argv, const char *prefix,
if (write_locked_index(the_repository->index, &index_lock, 0))
die(_("unable to write new index file"));
- hold_lock_file_for_update(&false_lock,
- git_path("next-index-%"PRIuMAX,
- (uintmax_t) getpid()),
+ path = repo_git_path(the_repository, "next-index-%"PRIuMAX,
+ (uintmax_t) getpid());
+ hold_lock_file_for_update(&false_lock, path,
LOCK_DIE_ON_ERROR);
create_base_index(current_head);
@@ -542,6 +543,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
out:
string_list_clear(&partial, 0);
clear_pathspec(&pathspec);
+ free(path);
return ret;
}