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

Re: git pull defaults for recursesubmodules

From
TVTommi Vainikainen <tvainika@gmail.com>
Date
Oct 24, 2018, 06:57 UTC
Message-ID
<CAGshahk7pY4rW5SQu73AdHMmxsbDCo5UP5LGF67FQYBws492TA@mail.gmail.com>
In-Reply-To
<20181023230324.GC6119@genre.crustytoothpaste.net>

ke 24. lokak. 2018 klo 2.03 brian m. carlson (sandals@crustytoothpaste.net) kirjoitti:

> You have an extra '1" at the end of this line.
> Also, missing sign-off.  See Documentation/SubmittingPatches.

After reading SubmittingPatches I didn't find if I should now send a fresh patch with changes squashed together or new commits appended after first commit in that patch. Patch is updated accordingly as fresh patch.

> Can we have a test that --no-recurse-submodules overrides
> fetch.recurseSubmodules?

Attached (sorry about that, I've no access now to more convenient mail setup) is refreshed patch which also tests that. I included it in same patch to follow style of other tests in t5572-pull-submodule.

-- 
Tommi Vainikainen


From 5d4b495f7c68a2e99314fef90e538e0d44ec1056 Mon Sep 17 00:00:00 2001
From: Tommi Vainikainen <thv@iki.fi>
Date: Wed, 24 Oct 2018 09:06:54 +0300
Subject: [PATCH] pull: obey fetch.recurseSubmodules when fetching

"git pull" now uses same recurse-submodules config for fetching as "git
fetch" by default if not overridden from command line.

The command line arg --recurse-submodules=no overrides
fetch.recurseSubmodules configuration.

Signed-off-by: Tommi Vainikainen <thv@iki.fi>
---
 builtin/pull.c            |  3 +++
 t/t5572-pull-submodule.sh | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/builtin/pull.c b/builtin/pull.c
index 681c127a07..bb51cb531d 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -346,6 +346,9 @@ static int git_pull_config(const char *var, const char *value, void *cb)
 		recurse_submodules = git_config_bool(var, value) ?
 			RECURSE_SUBMODULES_ON : RECURSE_SUBMODULES_OFF;
 		return 0;
+	} else if (!strcmp(var, "fetch.recursesubmodules")) {
+		recurse_submodules = parse_fetch_recurse_submodules_arg(var, value);
+		return 0;
 	}
 	return git_default_config(var, value, cb);
 }
diff --git a/t/t5572-pull-submodule.sh b/t/t5572-pull-submodule.sh
index f916729a12..66c479a135 100755
--- a/t/t5572-pull-submodule.sh
+++ b/t/t5572-pull-submodule.sh
@@ -75,6 +75,19 @@ test_expect_success "submodule.recurse option triggers recursive pull" '
 	test_path_is_file super/sub/merge_strategy_2.t
 '
 
+test_expect_success "fetch.recurseSubmodules=true triggers recursive pull" '
+	test_commit -C child fetch_recurse_submodules &&
+	git -C parent submodule update --remote &&
+	git -C parent add sub &&
+	git -C parent commit -m "update submodule" &&
+
+	git -C super config fetch.recurseSubmodules true &&
+	git -C super pull --recurse-submodules=no --no-rebase &&
+	test_path_is_missing super/sub/fetch_recurse_submodules.t &&
+	git -C super pull --no-rebase &&
+	test_path_is_file super/sub/fetch_recurse_submodules.t
+'
+
 test_expect_success " --[no-]recurse-submodule and submodule.recurse" '
 	test_commit -C child merge_strategy_3 &&
 	git -C parent submodule update --remote &&
-- 
2.19.1
Previous: brian m. carlsonNext: Junio C Hamano
Message 5 of 6 in “git pull defaults for recursesubmodules”
  1. Tommi VainikainenOct 23, 2018
  2. Stefan BellerOct 23, 2018
  3. Tommi VainikainenOct 24, 2018
  4. brian m. carlsonOct 23, 2018
  5. Tommi VainikainenOct 24, 2018
  6. Junio C HamanoOct 25, 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.