submodule recursing: do not write a config variable twice

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed May 26, 2017 at 12:10 UTC 58b75bd6db45a5108af41b764d617d677f26a6ca
3 files changed +3 -3
builtin/checkout.c
+1 -1
@@ -1182,7 +1182,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
1182 N_("second guess 'git checkout <no-such-branch>'")),
1183 OPT_BOOL(0, "ignore-other-worktrees", &opts.ignore_other_worktrees,
1184 N_("do not check if another worktree is holding the given ref")),
1185 - { OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules,
1185 + { OPTION_CALLBACK, 0, "recurse-submodules", NULL,
1186 "checkout", "control recursive updating of submodules",
1187 PARSE_OPT_OPTARG, option_parse_recurse_submodules },
1188 OPT_BOOL(0, "progress", &opts.show_progress, N_("force progress reporting")),
builtin/read-tree.c
+1 -1
@@ -157,7 +157,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
157 N_("skip applying sparse checkout filter")),
158 OPT_BOOL(0, "debug-unpack", &opts.debug_unpack,
159 N_("debug unpack-trees")),
160 - { OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules,
160 + { OPTION_CALLBACK, 0, "recurse-submodules", NULL,
161 "checkout", "control recursive updating of submodules",
162 PARSE_OPT_OPTARG, option_parse_recurse_submodules },
163 OPT_END()
builtin/reset.c
+1 -1
@@ -304,7 +304,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
304 N_("reset HEAD, index and working tree"), MERGE),
305 OPT_SET_INT(0, "keep", &reset_type,
306 N_("reset HEAD but keep local changes"), KEEP),
307 - { OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules,
307 + { OPTION_CALLBACK, 0, "recurse-submodules", NULL,
308 "reset", "control recursive updating of submodules",
309 PARSE_OPT_OPTARG, option_parse_recurse_submodules },
310 OPT_BOOL('p', "patch", &patch_mode, N_("select hunks interactively")),