path: drop git_pathdup() in favor of repo_git_path()

Remove `git_pathdup()` in favor of `repo_git_path()`. The latter does
essentially the same, with the only exception that it does not rely on
`the_repository` but takes the repo as separate parameter.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2025-02-07 12:03:32 +01:00
committed by Junio C Hamano
parent 7f17900b5b
commit bba59f58a4
16 changed files with 22 additions and 36 deletions

16
path.h
View File

@ -292,24 +292,10 @@ static inline const char *git_path(const char *fmt, ...)
{ \
static char *ret; \
if (!ret) \
ret = git_pathdup(filename); \
ret = repo_git_path(the_repository, filename); \
return ret; \
}
/*
* Return a path into the main repository's (the_repository) git directory.
*/
__attribute__((format (printf, 1, 2)))
static inline char *git_pathdup(const char *fmt, ...)
{
struct strbuf path = STRBUF_INIT;
va_list args;
va_start(args, fmt);
repo_git_pathv(the_repository, NULL, &path, fmt, args);
va_end(args);
return strbuf_detach(&path, NULL);
}
# endif /* USE_THE_REPOSITORY_VARIABLE */
#endif /* PATH_H */