path: expose `do_git_common_path()` as `repo_common_pathv()`
With the same reasoning as the preceding commit, expose the function `do_git_common_path()` as `repo_common_pathv()`. While at it, reorder parameters such that they match the order we have in `repo_git_pathv()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Aug 13, 2024 at 11:13 UTC
61419a42f641c7b9f7bfc9585e3ec9c393ab0166
2 files changed
+15
-12
path.c
+11
-11
@@ -617,16 +617,16 @@ int strbuf_git_path_submodule(struct strbuf *buf, const char *path,
617
return err;
618
}
619
620
-static void do_git_common_path(const struct repository *repo,
621
- struct strbuf *buf,
622
- const char *fmt,
623
- va_list args)
620
+void repo_common_pathv(const struct repository *repo,
621
+ struct strbuf *sb,
622
+ const char *fmt,
623
+ va_list args)
624
{
625
- strbuf_addstr(buf, repo->commondir);
626
- if (buf->len && !is_dir_sep(buf->buf[buf->len - 1]))
627
- strbuf_addch(buf, '/');
628
- strbuf_vaddf(buf, fmt, args);
629
- strbuf_cleanup_path(buf);
625
+ strbuf_addstr(sb, repo->commondir);
626
+ if (sb->len && !is_dir_sep(sb->buf[sb->len - 1]))
627
+ strbuf_addch(sb, '/');
628
+ strbuf_vaddf(sb, fmt, args);
629
+ strbuf_cleanup_path(sb);
630
}
631
632
const char *git_common_path(const char *fmt, ...)
@@ -634,7 +634,7 @@ const char *git_common_path(const char *fmt, ...)
634
struct strbuf *pathname = get_pathname();
635
va_list args;
636
va_start(args, fmt);
637
- do_git_common_path(the_repository, pathname, fmt, args);
637
+ repo_common_pathv(the_repository, pathname, fmt, args);
638
va_end(args);
639
return pathname->buf;
640
}
@@ -645,7 +645,7 @@ void strbuf_git_common_path(struct strbuf *sb,
645
{
646
va_list args;
647
va_start(args, fmt);
648
- do_git_common_path(repo, sb, fmt, args);
648
+ repo_common_pathv(repo, sb, fmt, args);
649
va_end(args);
650
}
651
path.h
+4
-1
@@ -37,6 +37,10 @@ void strbuf_git_common_path(struct strbuf *sb,
37
const struct repository *repo,
38
const char *fmt, ...)
39
__attribute__((format (printf, 3, 4)));
40
+void repo_common_pathv(const struct repository *repo,
41
+ struct strbuf *buf,
42
+ const char *fmt,
43
+ va_list args);
44
45
/*
46
* Return a statically allocated path into the main repository's
@@ -45,7 +49,6 @@ void strbuf_git_common_path(struct strbuf *sb,
49
const char *git_common_path(const char *fmt, ...)
50
__attribute__((format (printf, 1, 2)));
51
48
-
52
/*
53
* The `git_path` family of functions will construct a path into a repository's
54
* git directory.