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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/diff-merges.c b/diff-merges.c index 63912ddedc76..a30c730a457f 100644 --- a/diff-merges.c +++ b/diff-merges.c @@ -37,16 +37,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")) { @@ -94,4 +91,6 @@ void diff_merges_setup_revs(struct rev_info *revs) revs->ignore_merges = 1; 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; } -- 2.25.1