aboutsummaryrefslogtreecommitdiffstats
path: root/path.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-02-07 12:03:35 +0100
committerJunio C Hamano <gitster@pobox.com>2025-02-07 09:59:23 -0800
commit07242c2a5afb2a633feb110b1aa74e2adcc37575 (patch)
tree46297aaba2428ebd030ce81fa7cf8706fe88f80e /path.h
parentworktree: return allocated string from `get_worktree_git_dir()` (diff)
downloadgit-07242c2a5afb2a633feb110b1aa74e2adcc37575.tar.gz
git-07242c2a5afb2a633feb110b1aa74e2adcc37575.zip
path: drop `git_common_path()` in favor of `repo_common_path()`
Remove `git_common_path()` in favor of the `repo_common_path()` family of functions, which makes the implicit dependency on `the_repository` go away. Note that `git_common_path()` used to return 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()` from the public interface. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.h')
-rw-r--r--path.h19
1 files changed, 0 insertions, 19 deletions
diff --git a/path.h b/path.h
index cdc26acb74..bed0a4c6f9 100644
--- a/path.h
+++ b/path.h
@@ -233,31 +233,12 @@ struct strbuf *get_pathname(void);
# include "repository.h"
/* Internal implementation details that should not be used. */
-void repo_common_pathv(const struct repository *repo,
- struct strbuf *buf,
- const char *fmt,
- va_list args);
void repo_git_pathv(const struct repository *repo,
const struct worktree *wt, struct strbuf *buf,
const char *fmt, va_list args);
/*
* Return a statically allocated path into the main repository's
- * (the_repository) common git directory.
- */
-__attribute__((format (printf, 1, 2)))
-static inline const char *git_common_path(const char *fmt, ...)
-{
- struct strbuf *pathname = get_pathname();
- va_list args;
- va_start(args, fmt);
- repo_common_pathv(the_repository, pathname, fmt, args);
- va_end(args);
- return pathname->buf;
-}
-
-/*
- * Return a statically allocated path into the main repository's
* (the_repository) git directory.
*/
__attribute__((format (printf, 1, 2)))