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

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

From
Stefan Beller <sbeller@google.com>
Date
Nov 29, 2018, 00:27 UTC
Message-ID
<20181129002756.167615-9-sbeller@google.com>
In-Reply-To
<20181129002756.167615-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 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",
-- 
2.20.0.rc1.387.gf8505762e3-goog
Previous: Jonathan NiederNext: Jonathan Tan
Message 12 of 21 in “[PATCHv2 0/9] Resending sb/submodule-recursive-fetch-gets-the-tip”
  1. Stefan BellerNov 29, 2018
  2. 1/9 sha1-array: provide oid_array_filterStefan Beller, Nov 29, 2018
  3. 2/9 submodule.c: fix indentationStefan Beller, Nov 29, 2018
  4. 3/9 submodule.c: sort changed_submodule_names before searching itStefan Beller, Nov 29, 2018
  5. Jonathan TanDec 5, 2018
  6. 4/9 submodule.c: tighten scope of changed_submodule_names structStefan Beller, Nov 29, 2018
  7. 5/9 submodule: store OIDs in changed_submodule_namesStefan Beller, Nov 29, 2018
  8. 6/9 repository: repo_submodule_init to take a submodule structStefan Beller, Nov 29, 2018
  9. 7/9 submodule: migrate get_next_submodule to use repository structsStefan Beller, Nov 29, 2018
  10. Jonathan TanDec 5, 2018
  11. Jonathan NiederFeb 2, 2019
  12. 8/9 submodule.c: fetch in submodules git directory instead of in worktreeStefan Beller, Nov 29, 2018
  13. Jonathan TanDec 5, 2018
  14. 9/9 fetch: try fetching submodules if needed objects were not fetchedStefan Beller, Nov 29, 2018
  15. Jonathan TanDec 5, 2018
  16. fetch: ensure submodule objects fetchedStefan Beller, Dec 6, 2018
  17. Junio C HamanoDec 9, 2018
  18. Junio C HamanoDec 5, 2018
  19. Stefan BellerDec 6, 2018
  20. Josh SteadmonDec 7, 2018
  21. Jonathan NiederJan 15, 2019

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.