mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
path: add repo_git_path and strbuf_repo_git_path
Introduce 'repo_git_path' and 'strbuf_repo_git_path' which take a repository struct and constructs a path into the repository's git directory. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
543107333b
commit
3181d86320
21
path.c
21
path.c
@@ -416,6 +416,27 @@ static void do_git_path(const struct repository *repo,
|
||||
strbuf_cleanup_path(buf);
|
||||
}
|
||||
|
||||
char *repo_git_path(const struct repository *repo,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
struct strbuf path = STRBUF_INIT;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
do_git_path(repo, NULL, &path, fmt, args);
|
||||
va_end(args);
|
||||
return strbuf_detach(&path, NULL);
|
||||
}
|
||||
|
||||
void strbuf_repo_git_path(struct strbuf *sb,
|
||||
const struct repository *repo,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
do_git_path(repo, NULL, sb, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
char *git_path_buf(struct strbuf *buf, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
Reference in New Issue
Block a user