From: Duy Nguyen Date: Thu, 02 Mar 2017 12:43:11 GMT Subject: Re: [PATCH v5 08/24] files-backend: remove the use of git_path() Message-ID: In-Reply-To: <5c4a292e-ab86-ffe0-ba8d-c0fe1b527ec1@alum.mit.edu> On Wed, Mar 1, 2017 at 12:50 AM, Michael Haggerty wrote: >> @@ -995,7 +998,11 @@ static struct ref_store *files_ref_store_create(const char *submodule) >> return ref_store; >> } >> >> - refs->packed_refs_path = git_pathdup("packed-refs"); >> + refs->gitdir = xstrdup(gitdir); >> + get_common_dir_noenv(&sb, gitdir); >> + refs->gitcommondir = strbuf_detach(&sb, NULL); >> + strbuf_addf(&sb, "%s/packed-refs", refs->gitcommondir); >> + refs->packed_refs_path = strbuf_detach(&sb, NULL); > > `git_path()` and friends avoid adding an extra `/` if `git_dir()` > already ends in a slash or if it is the empty string. Here you don't > have that functionality. Is that intentional? Kind of. I noticed that behavior but the thinking was, this $GIT_DIR thing is going to get replaced soon anyway, and because the the uses of these paths are very clear (in three groups) that avoiding redundant slashes does not buy us anything extra, it's just more code. -- Duy