Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-06-22 21:43:40 +0300
committerJunio C Hamano <gitster@pobox.com>2017-06-24 04:24:34 +0300
commit3181d86320f748b7b4f7a7133f2127e825eed702 (patch)
tree36d81a714445306e298932642ec2653be76ff8e1 /path.c
parent543107333b3ed004bee282a83a518c7550d5a393 (diff)
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>
Diffstat (limited to 'path.c')
-rw-r--r--path.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/path.c b/path.c
index 2bdd0044f0..ffc0f10fde 100644
--- a/path.c
+++ b/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;