On Tue, Feb 27, 2018 at 1:57 AM, Eric Sunshine <sunsh...@sunshineco.com> wrote:

>> +       repo_set_commondir(repo, o->shared_root);
>
> The repo_set_gitdir() prototype (below) makes it seem as if the last
> argument ('o', in this case) is optional, presumably by passing in
> NULL, however, this code does not appear to be prepared to deal with
> NULL.

I know. I went this this struct because I really hate to write lots of
NULL without names

    repo_set_gitdir(gitdir, NULL, NULL, NULL, ...);

but I could not find a nicer way to make the whole struct optional,
not without repeating more code or using preprocessor. Given that this
function has 3-4 call sites max, I think it's still ok.

>
>> +       expand_base_dir(&repo->objects.objectdir, o->object_dir,
>> +                       repo->commondir, "objects");
>> +       expand_base_dir(&repo->graft_file, o->graft_file,
>> +                       repo->commondir, "info/grafts");
>> +       expand_base_dir(&repo->index_file, o->index_file,
>> +                       repo->gitdir, "index");
>>  }
-- 
Duy

Reply via email to