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

[PATCH 1/8] submodule recursing: do not write a config variable twice

From
Stefan Beller <sbeller@google.com>
Date
May 26, 2017, 19:10 UTC
Message-ID
<20170526191017.19155-2-sbeller@google.com>
In-Reply-To
<20170526191017.19155-1-sbeller@google.com>

The command line option for '--recurse-submodules' is implemented using an OPTION_CALLBACK, which takes both the callback (that sets the file static global variable) as well as passes the same file static global variable to the option parsing machinery to assign it. This is fixed in this commit by passing NULL as the variable. The callback sets it instead

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/checkout.c  | 2 +-
 builtin/read-tree.c | 2 +-
 builtin/reset.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index bfa5419f33..0fd57672cc 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1181,7 +1181,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 				N_("second guess 'git checkout <no-such-branch>'")),
 		OPT_BOOL(0, "ignore-other-worktrees", &opts.ignore_other_worktrees,
 			 N_("do not check if another worktree is holding the given ref")),
-		{ OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules,
+		{ OPTION_CALLBACK, 0, "recurse-submodules", NULL,
 			    "checkout", "control recursive updating of submodules",
 			    PARSE_OPT_OPTARG, option_parse_recurse_submodules },
 		OPT_BOOL(0, "progress", &opts.show_progress, N_("force progress reporting")),
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 23e212ee8c..2a1b8a530e 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -157,7 +157,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
 			 N_("skip applying sparse checkout filter")),
 		OPT_BOOL(0, "debug-unpack", &opts.debug_unpack,
 			 N_("debug unpack-trees")),
-		{ OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules,
+		{ OPTION_CALLBACK, 0, "recurse-submodules", NULL,
 			    "checkout", "control recursive updating of submodules",
 			    PARSE_OPT_OPTARG, option_parse_recurse_submodules },
 		OPT_END()
diff --git a/builtin/reset.c b/builtin/reset.c
index 5ce27fcaed..1e5f85b1fb 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -304,7 +304,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 				N_("reset HEAD, index and working tree"), MERGE),
 		OPT_SET_INT(0, "keep", &reset_type,
 				N_("reset HEAD but keep local changes"), KEEP),
-		{ OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules,
+		{ OPTION_CALLBACK, 0, "recurse-submodules", NULL,
 			    "reset", "control recursive updating of submodules",
 			    PARSE_OPT_OPTARG, option_parse_recurse_submodules },
 		OPT_BOOL('p', "patch", &patch_mode, N_("select hunks interactively")),
-- 
2.13.0.17.g582985b1e4
Previous: Stefan BellerNext: Stefan Beller
Message 2 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.