Git fork

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>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
61419a42 b6c6bfef

+15 -12
+11 -11
path.c
··· 617 617 return err; 618 618 } 619 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 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 630 } 631 631 632 632 const char *git_common_path(const char *fmt, ...) ··· 634 634 struct strbuf *pathname = get_pathname(); 635 635 va_list args; 636 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 638 va_end(args); 639 639 return pathname->buf; 640 640 } ··· 645 645 { 646 646 va_list args; 647 647 va_start(args, fmt); 648 - do_git_common_path(repo, sb, fmt, args); 648 + repo_common_pathv(repo, sb, fmt, args); 649 649 va_end(args); 650 650 } 651 651
+4 -1
path.h
··· 37 37 const struct repository *repo, 38 38 const char *fmt, ...) 39 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); 40 44 41 45 /* 42 46 * Return a statically allocated path into the main repository's ··· 44 48 */ 45 49 const char *git_common_path(const char *fmt, ...) 46 50 __attribute__((format (printf, 1, 2))); 47 - 48 51 49 52 /* 50 53 * The `git_path` family of functions will construct a path into a repository's