Do not set revs->diff when we encounter an option that needs it, as it'd be impossible to undo later. Besides, some other options than what we handle here set this flag as well, and we'd interfere with them trying to clear this flag later. Rather set revs->diff, if finally needed, in diff_merges_setup_revs(). As an additional bonus, this also makes our code shorter. Signed-off-by: Sergey Organov <sorganov@xxxxxxxxx> --- diff-merges.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/diff-merges.c b/diff-merges.c index c48a65f8de64..225edd293b43 100644 --- a/diff-merges.c +++ b/diff-merges.c @@ -41,16 +41,13 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv) revs->ignore_merges = 0; revs->match_missing = 1; } else if (!strcmp(arg, "-c")) { - revs->diff = 1; revs->dense_combined_merges = 0; revs->combine_merges = 1; } else if (!strcmp(arg, "--cc")) { - revs->diff = 1; set_dense_combined(revs); } else if (!strcmp(arg, "--no-diff-merges")) { suppress(revs); } else if (!strcmp(arg, "--combined-all-paths")) { - revs->diff = 1; revs->combined_all_paths = 1; } else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) { if (!strcmp(optarg, "off")) { @@ -103,6 +100,7 @@ void diff_merges_setup_revs(struct rev_info *revs) if (revs->combined_all_paths && !revs->combine_merges) die("--combined-all-paths makes no sense without -c or --cc"); if (revs->combine_merges) { + revs->diff = 1; /* Turn --cc/-c into -p --cc/-c when -p was not given */ if (!revs->diffopt.output_format) revs->diffopt.output_format = DIFF_FORMAT_PATCH; -- 2.25.1