Skip to content

Commit a62387b

Browse files
stefanbellergitster
authored andcommitted
submodule.c: fetch in submodules git directory instead of in worktree
Keep the properties introduced in 10f5c52 (submodule: avoid auto-discovery in prepare_submodule_repo_env(), 2016-09-01), by fixating the git directory of the submodule. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 26f80cc commit a62387b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

submodule.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,12 @@ void prepare_submodule_repo_env(struct argv_array *out)
494494
DEFAULT_GIT_DIR_ENVIRONMENT);
495495
}
496496

497+
static void prepare_submodule_repo_env_in_gitdir(struct argv_array *out)
498+
{
499+
prepare_submodule_repo_env_no_git_dir(out);
500+
argv_array_pushf(out, "%s=.", GIT_DIR_ENVIRONMENT);
501+
}
502+
497503
/* Helper function to display the submodule header line prior to the full
498504
* summary output. If it can locate the submodule objects directory it will
499505
* attempt to lookup both the left and right commits and put them into the
@@ -1327,8 +1333,8 @@ static int get_next_submodule(struct child_process *cp,
13271333
repo = get_submodule_repo_for(spf->r, submodule);
13281334
if (repo) {
13291335
child_process_init(cp);
1330-
cp->dir = xstrdup(repo->worktree);
1331-
prepare_submodule_repo_env(&cp->env_array);
1336+
cp->dir = xstrdup(repo->gitdir);
1337+
prepare_submodule_repo_env_in_gitdir(&cp->env_array);
13321338
cp->git_cmd = 1;
13331339
if (!spf->quiet)
13341340
strbuf_addf(err, "Fetching submodule %s%s\n",

0 commit comments

Comments
 (0)