Skip to content

Commit 61419a4

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b6c6bfe commit 61419a4

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

path.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -617,24 +617,24 @@ int strbuf_git_path_submodule(struct strbuf *buf, const char *path,
617617
return err;
618618
}
619619

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)
624624
{
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);
630630
}
631631

632632
const char *git_common_path(const char *fmt, ...)
633633
{
634634
struct strbuf *pathname = get_pathname();
635635
va_list args;
636636
va_start(args, fmt);
637-
do_git_common_path(the_repository, pathname, fmt, args);
637+
repo_common_pathv(the_repository, pathname, fmt, args);
638638
va_end(args);
639639
return pathname->buf;
640640
}
@@ -645,7 +645,7 @@ void strbuf_git_common_path(struct strbuf *sb,
645645
{
646646
va_list args;
647647
va_start(args, fmt);
648-
do_git_common_path(repo, sb, fmt, args);
648+
repo_common_pathv(repo, sb, fmt, args);
649649
va_end(args);
650650
}
651651

path.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ void strbuf_git_common_path(struct strbuf *sb,
3737
const struct repository *repo,
3838
const char *fmt, ...)
3939
__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);
4044

4145
/*
4246
* Return a statically allocated path into the main repository's
@@ -45,7 +49,6 @@ void strbuf_git_common_path(struct strbuf *sb,
4549
const char *git_common_path(const char *fmt, ...)
4650
__attribute__((format (printf, 1, 2)));
4751

48-
4952
/*
5053
* The `git_path` family of functions will construct a path into a repository's
5154
* git directory.

0 commit comments

Comments
 (0)