> diff --git a/setup.c b/setup.c > index c5d55dcee4..6fac1bb58a 100644 > --- a/setup.c > +++ b/setup.c > @@ -1116,8 +1116,7 @@ const char *setup_git_directory_gently(int *nongit_ok) > const char *gitdir = getenv(GIT_DIR_ENVIRONMENT); > if (!gitdir) > gitdir = DEFAULT_GIT_DIR_ENVIRONMENT; > - repo_set_gitdir(the_repository, gitdir); > - setup_git_env(); > + setup_git_env(gitdir); > } What makes git_dir special, such that we have to pass it in here? Could the check for getenv(GIT_DIR_ENVIRONMENT) and fallback to DEFAULT_... be part of setup_git_env() ? Oh I guess that cannot be done easily as the submodule code spcifically doesn't want to discover the git dir itself. > if (startup_info->have_repository) > repo_set_hash_algo(the_repository, repo_fmt.hash_algo); > -- > 2.16.1.435.g8f24da2e1a >