Re: [RFC PATCHv4] repack: rewrite the shell script in C.
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 20, 2013, 21:34 UTC
- Message-ID
- <20130820213452.GI4110@google.com>
- In-Reply-To
- <5213DE72.3000308@googlemail.com>
Stefan Beller wrote:
> On 08/20/2013 03:31 PM, Johannes Sixt wrote:
Show 15 quoted lines
>>> + packdir = mkpathdup("%s/pack", get_object_directory());
>>> + packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, getpid());
>>
>> Should this not be
>>
>> packdir = xstrdup(git_path("pack"));
>> packtmp = xstrdup(git_path("pack/.tmp-%d-pack", getpid()));
>
> Just a question for documentational purpose. ;)
> Am I right suggesting the following:
>
> `mkpathdup`::
> Use parameters to build the path on the filesystem,
> i.e. create required folders and then return a duplicate
> of that path. The caller is responsible to free the memoryRight. mkpathdup is basically just mkpath composed with xstrdup, except that it avoids stomping on mkpath's buffers.
The corresponding almost-shortcut for xstrdup(git_path(s)) is git_pathdup(s). But that's a minor detail.
Maybe a new Documentation/technical/api-paths.txt is in order.
Thanks, Jonathan