From: Duy Nguyen Date: Fri, 09 Dec 2016 12:33:34 GMT Subject: Re: [PATCH v2 0/4] road to reentrant real_path Message-ID: In-Reply-To: <1481241494-6861-1-git-send-email-bmwill@google.com> On Fri, Dec 9, 2016 at 6:58 AM, Brandon Williams wrote: > diff --git a/setup.c b/setup.c > index fe572b8..0d9fdd0 100644 > --- a/setup.c > +++ b/setup.c > @@ -254,10 +254,12 @@ int get_common_dir_noenv(struct strbuf *sb, const char *gitdir) > if (!is_absolute_path(data.buf)) > strbuf_addf(&path, "%s/", gitdir); > strbuf_addbuf(&path, &data); > - strbuf_addstr(sb, real_path(path.buf)); > + strbuf_realpath(sb, path.buf, 1); This is not the same because of this hunk in strbuf_realpath() > @@ -81,17 +73,18 @@ static const char *real_path_internal(const char *path, int die_on_error) > goto error_out; > } > > - strbuf_reset(&resolved); > + strbuf_reset(resolved); > > if (is_absolute_path(path)) { But if you you remove that, then all (old) callers of strbuf_realpath() must do a strbuf_reset() in advance if needed (probably just real_path does) which sounds reasonable to me. You're probably want to be careful about the strbuf_reset() at the end of the function too. Other than that, I think this diff looks nice. -- Duy