Junio C Hamano <gitster@xxxxxxxxx> writes: >> + 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.