Skip to content

Commit 58b75bd

Browse files
stefanbellergitster
authored andcommitted
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>
1 parent 234b10d commit 58b75bd

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
11821182
N_("second guess 'git checkout <no-such-branch>'")),
11831183
OPT_BOOL(0, "ignore-other-worktrees", &opts.ignore_other_worktrees,
11841184
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,
11861186
"checkout", "control recursive updating of submodules",
11871187
PARSE_OPT_OPTARG, option_parse_recurse_submodules },
11881188
OPT_BOOL(0, "progress", &opts.show_progress, N_("force progress reporting")),

builtin/read-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
157157
N_("skip applying sparse checkout filter")),
158158
OPT_BOOL(0, "debug-unpack", &opts.debug_unpack,
159159
N_("debug unpack-trees")),
160-
{ OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules,
160+
{ OPTION_CALLBACK, 0, "recurse-submodules", NULL,
161161
"checkout", "control recursive updating of submodules",
162162
PARSE_OPT_OPTARG, option_parse_recurse_submodules },
163163
OPT_END()

builtin/reset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
304304
N_("reset HEAD, index and working tree"), MERGE),
305305
OPT_SET_INT(0, "keep", &reset_type,
306306
N_("reset HEAD but keep local changes"), KEEP),
307-
{ OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules,
307+
{ OPTION_CALLBACK, 0, "recurse-submodules", NULL,
308308
"reset", "control recursive updating of submodules",
309309
PARSE_OPT_OPTARG, option_parse_recurse_submodules },
310310
OPT_BOOL('p', "patch", &patch_mode, N_("select hunks interactively")),

0 commit comments

Comments
 (0)