Re: [PATCH v2 01/12] path.c: add git_common_path() and strbuf_git_common_path()

2016-04-20 Thread Duy Nguyen
On Thu, Apr 21, 2016 at 1:11 AM, Eric Sunshine wrote: > On Wed, Apr 20, 2016 at 9:24 AM, Nguyễn Thái Ngọc Duy > wrote: >> diff --git a/path.c b/path.c >> @@ -503,6 +503,35 @@ void strbuf_git_path_submodule(struct strbuf *buf, >> const char *path, >> +const char *git_common_path(const char *fmt,

Re: [PATCH v2 01/12] path.c: add git_common_path() and strbuf_git_common_path()

2016-04-20 Thread Eric Sunshine
On Wed, Apr 20, 2016 at 9:24 AM, Nguyễn Thái Ngọc Duy wrote: > diff --git a/path.c b/path.c > @@ -503,6 +503,35 @@ void strbuf_git_path_submodule(struct strbuf *buf, const > char *path, > +const char *git_common_path(const char *fmt, ...) > +{ > + struct strbuf *pathname = get_pathname(); >

[PATCH v2 01/12] path.c: add git_common_path() and strbuf_git_common_path()

2016-04-20 Thread Nguyễn Thái Ngọc Duy
These are mostly convenient functions to reduce code duplication. Most of the time, we should be able to get by with git_path() which handles $GIT_COMMON_DIR internally. However there are a few cases where we need to construct paths manually, for example some paths from a specific worktree. These f