Re: [PATCH v5 08/24] files-backend: remove the use of git_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 1, 2017 at 12:50 AM, Michael Haggerty <mhagger@xxxxxxxxxxxx> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]