Skip to content

Commit e121b4b

Browse files
sorganovgitster
authored andcommitted
diff-merges: revise revs->diff flag handling
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@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 0c627f5 commit e121b4b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

diff-merges.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,13 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
4141
revs->ignore_merges = 0;
4242
revs->match_missing = 1;
4343
} else if (!strcmp(arg, "-c")) {
44-
revs->diff = 1;
4544
revs->dense_combined_merges = 0;
4645
revs->combine_merges = 1;
4746
} else if (!strcmp(arg, "--cc")) {
48-
revs->diff = 1;
4947
set_dense_combined(revs);
5048
} else if (!strcmp(arg, "--no-diff-merges")) {
5149
suppress(revs);
5250
} else if (!strcmp(arg, "--combined-all-paths")) {
53-
revs->diff = 1;
5451
revs->combined_all_paths = 1;
5552
} else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) {
5653
if (!strcmp(optarg, "off")) {
@@ -103,6 +100,7 @@ void diff_merges_setup_revs(struct rev_info *revs)
103100
if (revs->combined_all_paths && !revs->combine_merges)
104101
die("--combined-all-paths makes no sense without -c or --cc");
105102
if (revs->combine_merges) {
103+
revs->diff = 1;
106104
/* Turn --cc/-c into -p --cc/-c when -p was not given */
107105
if (!revs->diffopt.output_format)
108106
revs->diffopt.output_format = DIFF_FORMAT_PATCH;

0 commit comments

Comments
 (0)