git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 08/10] submodule.c: fetch in submodules git directory instead of in worktree

From
Stefan Beller <sbeller@google.com>
Date
Oct 25, 2018, 23:32 UTC
Message-ID
<20181025233231.102245-9-sbeller@google.com>
In-Reply-To
<20181025233231.102245-1-sbeller@google.com>

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>
---
 submodule.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/submodule.c b/submodule.c
index a1a32cab7d..67813fbe78 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
@@ -1313,8 +1319,8 @@ static int get_next_submodule(struct child_process *cp,
 		repo = get_submodule_repo_for(spf->r, submodule);
 		if (repo) {
 			child_process_init(cp);
-			prepare_submodule_repo_env(&cp->env_array);
-			cp->dir = xstrdup(repo->worktree);
+			prepare_submodule_repo_env_in_gitdir(&cp->env_array);
+			cp->dir = xstrdup(repo->gitdir);
 			cp->git_cmd = 1;
 			if (!spf->quiet)
 				strbuf_addf(err, "Fetching submodule %s%s\n",
-- 
2.19.0
Previous: Jonathan TanNext: Stefan Beller
Message 13 of 19 in “Resending sb/submodule-recursive-fetch-gets-the-tip”
  1. 00/10 Resending sb/submodule-recursive-fetch-gets-the-tipStefan Beller, Oct 25, 2018
  2. 01/10 sha1-array: provide oid_array_filterStefan Beller, Oct 25, 2018
  3. 02/10 submodule.c: fix indentationStefan Beller, Oct 25, 2018
  4. 03/10 submodule.c: sort changed_submodule_names before searching itStefan Beller, Oct 25, 2018
  5. 04/10 submodule.c: tighten scope of changed_submodule_names structStefan Beller, Oct 25, 2018
  6. 05/10 submodule: store OIDs in changed_submodule_namesStefan Beller, Oct 25, 2018
  7. Jonathan TanOct 26, 2018
  8. 06/10 repository: repo_submodule_init to take a submodule structStefan Beller, Oct 25, 2018
  9. Jonathan TanOct 26, 2018
  10. Stefan BellerOct 26, 2018
  11. 07/10 submodule: migrate get_next_submodule to use repository structsStefan Beller, Oct 25, 2018
  12. Jonathan TanOct 26, 2018
  13. 08/10 submodule.c: fetch in submodules git directory instead of in worktreeStefan Beller, Oct 25, 2018
  14. 09/10 fetch: try fetching submodules if needed objects were not fetchedStefan Beller, Oct 25, 2018
  15. Jonathan TanOct 26, 2018
  16. Stefan BellerNov 29, 2018
  17. 10/10 builtin/fetch: check for submodule updates in any ref updateStefan Beller, Oct 25, 2018
  18. Jonathan TanOct 26, 2018
  19. Junio C HamanoOct 29, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.