aboutsummaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-06-22 11:43:37 -0700
committerJunio C Hamano <gitster@pobox.com>2017-06-23 18:24:34 -0700
commitb337172c834b854903fb523416b53fe354b6e2a5 (patch)
treeb9564e87ca662f9c0bafacab66642cc0dd82175c /path.c
parent7aee36013af88c5b61c5b07196555249a11993d2 (diff)
downloadgit-b337172c834b854903fb523416b53fe354b6e2a5.tar.gz
git-b337172c834b854903fb523416b53fe354b6e2a5.tar.xz
path: convert strbuf_git_common_path to take a 'struct repository'
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.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/path.c b/path.c
index 2434921d8..9be6804a9 100644
--- a/path.c
+++ b/path.c
@@ -524,11 +524,12 @@ int strbuf_git_path_submodule(struct strbuf *buf, const char *path,
return err;
}
-static void do_git_common_path(struct strbuf *buf,
+static void do_git_common_path(const struct repository *repo,
+ struct strbuf *buf,
const char *fmt,
va_list args)
{
- strbuf_addstr(buf, get_git_common_dir());
+ strbuf_addstr(buf, repo->commondir);
if (buf->len && !is_dir_sep(buf->buf[buf->len - 1]))
strbuf_addch(buf, '/');
strbuf_vaddf(buf, fmt, args);
@@ -540,16 +541,18 @@ const char *git_common_path(const char *fmt, ...)
struct strbuf *pathname = get_pathname();
va_list args;
va_start(args, fmt);
- do_git_common_path(pathname, fmt, args);
+ do_git_common_path(the_repository, pathname, fmt, args);
va_end(args);
return pathname->buf;
}
-void strbuf_git_common_path(struct strbuf *sb, const char *fmt, ...)
+void strbuf_git_common_path(struct strbuf *sb,
+ const struct repository *repo,
+ const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
- do_git_common_path(sb, fmt, args);
+ do_git_common_path(repo, sb, fmt, args);
va_end(args);
}