diff options
author | Stefan Beller <sbeller@google.com> | 2018-11-29 01:27:55 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-12-05 03:42:32 +0100 |
commit | a62387b3fc9f5aeeb04a2db278121d33a9caafa7 (patch) | |
tree | 665bb45d1fce4d4d15c3564aae78bd4fa256b67a /submodule.c | |
parent | submodule: migrate get_next_submodule to use repository structs (diff) | |
download | git-a62387b3fc9f5aeeb04a2db278121d33a9caafa7.tar.xz git-a62387b3fc9f5aeeb04a2db278121d33a9caafa7.zip |
submodule.c: fetch in submodules git directory instead of in worktree
Keep the properties introduced in 10f5c52656 (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>
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/submodule.c b/submodule.c index 77ace5e784..d1b6646f42 100644 --- a/submodule.c +++ b/submodule.c @@ -494,6 +494,12 @@ void prepare_submodule_repo_env(struct argv_array *out) DEFAULT_GIT_DIR_ENVIRONMENT); } +static void prepare_submodule_repo_env_in_gitdir(struct argv_array *out) +{ + prepare_submodule_repo_env_no_git_dir(out); + argv_array_pushf(out, "%s=.", GIT_DIR_ENVIRONMENT); +} + /* Helper function to display the submodule header line prior to the full * summary output. If it can locate the submodule objects directory it will * 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, repo = get_submodule_repo_for(spf->r, submodule); if (repo) { child_process_init(cp); - cp->dir = xstrdup(repo->worktree); - prepare_submodule_repo_env(&cp->env_array); + cp->dir = xstrdup(repo->gitdir); + prepare_submodule_repo_env_in_gitdir(&cp->env_array); cp->git_cmd = 1; if (!spf->quiet) strbuf_addf(err, "Fetching submodule %s%s\n", |