Re: [PATCH v3 02/25] Convert git_snpath() to strbuf_git_path()

2014-02-20 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > @@ -2717,17 +2729,19 @@ static int copy_msg(char *buf, const char *msg) > return cp - buf; > } > > -int log_ref_setup(const char *refname, char *logfile, int bufsize) > +int log_ref_setup(const char *refname, struct strbuf *sb_logfile) > { > int log

Re: [PATCH v3 02/25] Convert git_snpath() to strbuf_git_path()

2014-02-20 Thread Junio C Hamano
Duy Nguyen writes: > OK so your question was if there was a git_path() or mkpath() call > earlier in update_refs_for_switch() and the result was expected to > remain stable till the end of update_refs_for_switch(), then this > conversion could ruin it, correct? I didn't think about that,... Yeah

Re: [PATCH v3 02/25] Convert git_snpath() to strbuf_git_path()

2014-02-19 Thread Duy Nguyen
On Thu, Feb 20, 2014 at 10:41 AM, Junio C Hamano wrote: > Duy Nguyen writes: > - } + if (old->path && old->name && + !file_exists(git_path("%s", old->path)) && + file_exists(git_path("logs/%s", old->path))) +

Re: [PATCH v3 02/25] Convert git_snpath() to strbuf_git_path()

2014-02-19 Thread Junio C Hamano
Duy Nguyen writes: >>> - } >>> + if (old->path && old->name && >>> + !file_exists(git_path("%s", old->path)) && >>> + file_exists(git_path("logs/%s", old->path))) >>> + remove_path(git_path("logs/%s", old->path)); >> >>

Re: [PATCH v3 02/25] Convert git_snpath() to strbuf_git_path()

2014-02-19 Thread Duy Nguyen
On Thu, Feb 20, 2014 at 6:48 AM, Junio C Hamano wrote: > Nguyễn Thái Ngọc Duy writes: > >> @@ -651,14 +653,10 @@ static void update_refs_for_switch(const struct >> checkout_opts *opts, >> new->name); >> } >> } >> -

Re: [PATCH v3 02/25] Convert git_snpath() to strbuf_git_path()

2014-02-19 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > @@ -651,14 +653,10 @@ static void update_refs_for_switch(const struct > checkout_opts *opts, > new->name); > } > } > - if (old->path && old->name) { > - char

[PATCH v3 02/25] Convert git_snpath() to strbuf_git_path()

2014-02-18 Thread Nguyễn Thái Ngọc Duy
In the previous patch, git_snpath() is modified to take a strbuf buffer from get_pathname() because vsnpath() needs that. But that makes it awkward because git_snpath() receives a pre-allocated buffer from outside and has to copy data back. Rename it to strbuf_git_path() and make it receive strbuf