On Wed, Mar 1, 2017 at 12:50 AM, Michael Haggerty <mhag...@alum.mit.edu> 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