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

[PATCH] builtin/fetch cleanup: always set default value for submodule recursing

From
Stefan Beller <sbeller@google.com>
Date
Jun 27, 2017, 21:31 UTC
Message-ID
<20170627213159.3717-1-sbeller@google.com>
In-Reply-To
<CAGZ79kZUkQCEEcLUcg8tSr33Wng1Fq4_i4n80+Xr45y0mcvB6A@mail.gmail.com>

The check for the default was introduced with 88a21979c5 (fetch/pull: recurse into submodules when necessary, 2011-03-06), which replaced an older construct (builtin/fetchs own implementation of the super-prefix) introduced in be254a0ea9 (Add the 'fetch.recurseSubmodules' config setting, 2010-11-11) which made sense at the time as there was no default fetch option for submodules at the time.

Set builtin/fetch.c#recurse_submodules_default to the same value as submodule.c#config_fetch_recurse_submodules which is set via set_config_fetch_recurse_submodules, such that the condition for checking whether we have to set the default value becomes unnecessary.

Signed-off-by: Stefan Beller <sbeller@google.com>
---

This queues on top of origin/sb/pull-rebase-submodule, and answers questions raised in the review of origin/sb/pull-rebase-submodule^.

I thought about just squashing these two patches, but they do different cleanups so I am personally fine with having them both.

I may squash them if further review of that series requires a resend of the whole series.

Thanks, Stefan

 builtin/fetch.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 3cca568173..7ea52b8b07 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -49,7 +49,7 @@ static struct transport *gtransport;
 static struct transport *gsecondary;
 static const char *submodule_prefix = "";
 static int recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
-static int recurse_submodules_default = RECURSE_SUBMODULES_DEFAULT;
+static int recurse_submodules_default = RECURSE_SUBMODULES_ON_DEMAND;
 static int shown_url = 0;
 static int refmap_alloc, refmap_nr;
 static const char **refmap_array;
@@ -1336,8 +1336,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 		deepen = 1;
 
 	if (recurse_submodules != RECURSE_SUBMODULES_OFF) {
-		if (recurse_submodules_default != RECURSE_SUBMODULES_DEFAULT)
-			set_config_fetch_recurse_submodules(recurse_submodules_default);
+		set_config_fetch_recurse_submodules(recurse_submodules_default);
 		gitmodules_config();
 		git_config(submodule_config, NULL);
 	}
-- 
2.13.1.519.gc4803e3bc3
Previous: Stefan BellerNext: Stefan Beller
Message 9 of 10 in “pull: optionally rebase submodules”
  1. 0/3 pull: optionally rebase submodulesStefan Beller, Jun 23, 2017
  2. 1/3 builtin/fetch: factor submodule recurse parsing out to submodule configStefan Beller, Jun 23, 2017
  3. Junio C HamanoJun 23, 2017
  4. 2/3 builtin/fetch: parse recurse-submodules-default at default options parsingStefan Beller, Jun 23, 2017
  5. Junio C HamanoJun 23, 2017
  6. Stefan BellerJun 23, 2017
  7. Junio C HamanoJun 24, 2017
  8. Stefan BellerJun 27, 2017
  9. builtin/fetch cleanup: always set default value for submodule recursingStefan Beller, Jun 27, 2017
  10. 3/3 pull: optionally rebase submodules (remote submodule changes only)Stefan Beller, Jun 23, 2017

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.