Re: [PATCH v2 2/3] config: handle conditional include when $GIT_DIR is not set up
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 18, 2017, 02:56 UTC
- Message-ID
- <xmqqzifefmog.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <xmqq7f2ih1l1.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 13 quoted lines
>> + if (!have_git_dir() && opts.git_dir) {
>> struct git_config_source repo_config;
>>
>> memset(&repo_config, 0, sizeof(repo_config));
>
> But this one I do not quite understand. When have_git_dir() was
> false and asked discover_git_directory() to set opts.git_dir, we
> enter the body of this block and then end up doing
>
> git_config_with_options(cb, data &repo_config, &opts);
>
> with repo_config set to the discovered git directory plus "/config";
> we'd read the repository configuration twice, in other words.Ahh, nevermind. The fix to make the "usual sequence" pay attention to the opts->git_dir comes in 3/3 and in that step this redundant reading is also removed, so all is well at the end.
Thanks.