aboutsummaryrefslogtreecommitdiffstats
path: root/shallow.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-02-07 12:03:37 +0100
committerJunio C Hamano <gitster@pobox.com>2025-02-28 13:54:11 -0800
commit88dd321cfedc6ee190dfafe4670a83ea33cdf4a3 (patch)
tree0e94e96531181af8d226066182f92e8ae90da1ab /shallow.c
parentrerere: let `rerere_path()` write paths into a caller-provided buffer (diff)
downloadgit-88dd321cfedc6ee190dfafe4670a83ea33cdf4a3.tar.gz
git-88dd321cfedc6ee190dfafe4670a83ea33cdf4a3.zip
path: drop `git_path()` in favor of `repo_git_path()`
Remove `git_path()` in favor of the `repo_git_path()` family of functions, which makes the implicit dependency on `the_repository` go away. Note that `git_path()` returned a string allocated via `get_pathname()`, which uses a rotating set of statically allocated buffers. Consequently, callers didn't have to free the returned string. The same isn't true for `repo_common_path()`, so we also have to add logic to free the returned strings. This refactoring also allows us to remove `repo_common_pathv()` as well as `get_pathname()` from the public interface. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'shallow.c')
-rw-r--r--shallow.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/shallow.c b/shallow.c
index b54244ffa9..4bd9342c9a 100644
--- a/shallow.c
+++ b/shallow.c
@@ -364,7 +364,9 @@ const char *setup_temporary_shallow(const struct oid_array *extra)
struct strbuf sb = STRBUF_INIT;
if (write_shallow_commits(&sb, 0, extra)) {
- temp = xmks_tempfile(git_path("shallow_XXXXXX"));
+ char *path = repo_git_path(the_repository, "shallow_XXXXXX");
+ temp = xmks_tempfile(path);
+ free(path);
if (write_in_full(temp->fd, sb.buf, sb.len) < 0 ||
close_tempfile_gently(temp) < 0)