Skip to content

Commit 62c5358

Browse files
peffgitster
authored andcommitted
merge: do not pass unused opt->value parameter
The option_parse_strategy() callback does not look at opt->value; instead it calls append_strategy(), which manipulates the global use_strategies array directly. But the OPT_CALLBACK declaration assigns "&use_strategies" to opt->value. One could argue this is good, as it tells the reader what we generally expect the callback to do. But it is also bad, because it can mislead you into thinking that swapping out "&use_strategies" there might have any effect. Let's switch it to pass NULL (which is what every other "does not bother to look at opt->value" callback does). If you want to know what the callback does, it's easy to read the function itself. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 34bf44f commit 62c5358

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static struct option builtin_merge_options[] = {
264264
OPT_RERERE_AUTOUPDATE(&allow_rerere_auto),
265265
OPT_BOOL(0, "verify-signatures", &verify_signatures,
266266
N_("verify that the named commit has a valid GPG signature")),
267-
OPT_CALLBACK('s', "strategy", &use_strategies, N_("strategy"),
267+
OPT_CALLBACK('s', "strategy", NULL, N_("strategy"),
268268
N_("merge strategy to use"), option_parse_strategy),
269269
OPT_STRVEC('X', "strategy-option", &xopts, N_("option=value"),
270270
N_("option for selected merge strategy")),

0 commit comments

Comments
 (0)