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

2014-02-20 Thread Junio C Hamano
Duy Nguyen pclo...@gmail.com 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

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 pclo...@gmail.com 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) {

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 pclo...@gmail.com writes: @@ -651,14 +653,10 @@ static void update_refs_for_switch(const struct checkout_opts *opts, new-name); } } - if (old-path old-name) { -

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 gits...@pobox.com wrote: Nguyễn Thái Ngọc Duy pclo...@gmail.com 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
Duy Nguyen pclo...@gmail.com 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)); Hmph. Is this

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 gits...@pobox.com wrote: Duy Nguyen pclo...@gmail.com writes: - } + if (old-path old-name + !file_exists(git_path(%s, old-path)) + file_exists(git_path(logs/%s, old-path))) +

[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