diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-02-07 12:03:37 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-28 13:54:11 -0800 |
| commit | 88dd321cfedc6ee190dfafe4670a83ea33cdf4a3 (patch) | |
| tree | 0e94e96531181af8d226066182f92e8ae90da1ab /builtin/remote.c | |
| parent | rerere: let `rerere_path()` write paths into a caller-provided buffer (diff) | |
| download | git-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 'builtin/remote.c')
| -rw-r--r-- | builtin/remote.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/remote.c b/builtin/remote.c index 71d84fb3cf..0489fcc8f3 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -644,9 +644,11 @@ static int migrate_file(struct remote *remote) git_config_set_multivar(buf.buf, remote->fetch.items[i].raw, "^$", 0); #ifndef WITH_BREAKING_CHANGES if (remote->origin == REMOTE_REMOTES) - unlink_or_warn(git_path("remotes/%s", remote->name)); + unlink_or_warn(repo_git_path_replace(the_repository, &buf, + "remotes/%s", remote->name)); else if (remote->origin == REMOTE_BRANCHES) - unlink_or_warn(git_path("branches/%s", remote->name)); + unlink_or_warn(repo_git_path_replace(the_repository, &buf, + "branches/%s", remote->name)); #endif /* WITH_BREAKING_CHANGES */ strbuf_release(&buf); |
