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

[PATCHv3 3/4] builtin/push.c: respect 'submodule.recurse' option

From
Stefan Beller <sbeller@google.com>
Date
Jun 1, 2017, 00:30 UTC
Message-ID
<20170601003050.4221-4-sbeller@google.com>
In-Reply-To
<20170601003050.4221-1-sbeller@google.com>

The closest mapping from the boolean 'submodule.recurse' set to "yes" to the variety of submodule push modes is "on-demand", so implement that.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/push.c                 |  4 ++++
 t/t5531-deep-submodule-push.sh | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)
diff --git a/builtin/push.c b/builtin/push.c
index a597759d8f..258648d5fd 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -498,6 +498,10 @@ static int git_push_config(const char *k, const char *v, void *cb)
 		const char *value;
 		if (!git_config_get_value("push.recursesubmodules", &value))
 			recurse_submodules = parse_push_recurse_submodules_arg(k, value);
+	} else if (!strcmp(k, "submodule.recurse")) {
+		int val = git_config_bool(k, v) ?
+			RECURSE_SUBMODULES_ON_DEMAND : RECURSE_SUBMODULES_OFF;
+		recurse_submodules = val;
 	}
 
 	return git_default_config(k, v, NULL);
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 57ba322628..712c595fd8 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -126,6 +126,27 @@ test_expect_success 'push succeeds if submodule commit not on remote but using o
 	)
 '
 
+test_expect_success 'push succeeds if submodule commit not on remote but using auto-on-demand via submodule.recurse config' '
+	(
+		cd work/gar/bage &&
+		>recurse-on-demand-from-submodule-recurse-config &&
+		git add recurse-on-demand-from-submodule-recurse-config &&
+		git commit -m "Recurse submodule.recurse from config junk"
+	) &&
+	(
+		cd work &&
+		git add gar/bage &&
+		git commit -m "Recurse submodule.recurse from config for gar/bage" &&
+		git -c submodule.recurse push ../pub.git master &&
+		# Check that the supermodule commit got there
+		git fetch ../pub.git &&
+		git diff --quiet FETCH_HEAD master &&
+		# Check that the submodule commit got there too
+		cd gar/bage &&
+		git diff --quiet origin/master master
+	)
+'
+
 test_expect_success 'push recurse-submodules on command line overrides config' '
 	(
 		cd work/gar/bage &&
-- 
2.13.0.17.gab62347cd9
Previous: Stefan BellerNext: Stefan Beller
Message 13 of 15 in “[PATCHv2 0/8] A reroll of sb/submodule-blanket-recursive”
  1. Stefan BellerMay 26, 2017
  2. 1/8 submodule recursing: do not write a config variable twiceStefan Beller, May 26, 2017
  3. 4/8 submodule loading: separate code path for .gitmodules and config overlayStefan Beller, May 26, 2017
  4. 8/8 builtin/fetch.c: respect 'submodule.recurse' optionStefan Beller, May 26, 2017
  5. 5/8 Introduce 'submodule.recurse' option for worktree manipulatorsStefan Beller, May 26, 2017
  6. 3/8 reset/checkout/read-tree: unify config callback for submodule recursionStefan Beller, May 26, 2017
  7. 6/8 builtin/grep.c: respect 'submodule.recurse' optionStefan Beller, May 26, 2017
  8. 2/8 submodule test invocation: only pass additional argumentsStefan Beller, May 26, 2017
  9. 7/8 builtin/push.c: respect 'submodule.recurse' optionStefan Beller, May 26, 2017
  10. Junio C HamanoMay 30, 2017
  11. 0/4 A reroll of sb/submodule-blanket-recursiveStefan Beller, Jun 1, 2017
  12. 1/4 Introduce 'submodule.recurse' option for worktree manipulatorsStefan Beller, Jun 1, 2017
  13. 3/4 builtin/push.c: respect 'submodule.recurse' optionStefan Beller, Jun 1, 2017
  14. 2/4 builtin/grep.c: respect 'submodule.recurse' optionStefan Beller, Jun 1, 2017
  15. 4/4 builtin/fetch.c: respect 'submodule.recurse' optionStefan Beller, Jun 1, 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.