From: Duy Nguyen Date: Tue, 27 Feb 2018 09:11:44 GMT Subject: Re: [PATCH 1/4] repository.c: move env-related setup code back to environment.c Message-ID: In-Reply-To: On Tue, Feb 27, 2018 at 1:57 AM, Eric Sunshine 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