Re: [PATCH 1/4] repository.c: move env-related setup code back to environment.c
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 27, 2018, 09:11 UTC
- Message-ID
- <CACsJy8AqXNGMdCmF5smooLyWBuiKmXG6mckquiPekWZ8GwF5Qg@mail.gmail.com>
- In-Reply-To
- <CAPig+cRkEzN-dHh9R0cX5gOhsJ7X5evAMfpWuCnVp_QN3uz8ng@mail.gmail.com>
On Tue, Feb 27, 2018 at 1:57 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 6 quoted lines
>> + 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.
Show 8 quoted lines
> >> + 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