summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--diff-merges.c31
-rw-r--r--log-tree.c15
-rw-r--r--revision.h3
3 files changed, 23 insertions, 26 deletions
diff --git a/diff-merges.c b/diff-merges.c
index 047bf81e67..eff54cca82 100644
--- a/diff-merges.c
+++ b/diff-merges.c
@@ -4,7 +4,7 @@
static void suppress(struct rev_info *revs)
{
- revs->ignore_merges = 1;
+ revs->separate_merges = 0;
revs->first_parent_merges = 0;
revs->combine_merges = 0;
revs->dense_combined_merges = 0;
@@ -23,7 +23,6 @@ static void set_dense_combined(struct rev_info *revs)
void diff_merges_init_revs(struct rev_info *revs)
{
- revs->ignore_merges = -1;
}
int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
@@ -39,7 +38,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
* family of commands, it means "show full diff for merges". Set
* both fields appropriately.
*/
- revs->ignore_merges = 0;
+ revs->separate_merges = 1;
revs->match_missing = 1;
} else if (!strcmp(arg, "-c")) {
revs->dense_combined_merges = 0;
@@ -57,8 +56,9 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
die(_("unknown value for --diff-merges: %s"), optarg);
}
} else
- argcount = 0;
+ return 0;
+ revs->explicit_diff_merges = 1;
return argcount;
}
@@ -69,21 +69,16 @@ void diff_merges_suppress(struct rev_info *revs)
void diff_merges_default_to_first_parent(struct rev_info *revs)
{
- if (revs->ignore_merges < 0) /* No -m */
- revs->ignore_merges = 0;
- if (!revs->combine_merges) /* No -c/--cc" */
+ if (!revs->explicit_diff_merges)
+ revs->separate_merges = 1;
+ if (revs->separate_merges)
revs->first_parent_merges = 1;
}
void diff_merges_default_to_dense_combined(struct rev_info *revs)
{
- if (revs->ignore_merges < 0) { /* No -m */
- revs->ignore_merges = 0;
- if (!revs->combine_merges) { /* No -c/--cc" */
- revs->combine_merges = 1;
- revs->dense_combined_merges = 1;
- }
- }
+ if (!revs->explicit_diff_merges)
+ set_dense_combined(revs);
}
void diff_merges_set_dense_combined_if_unset(struct rev_info *revs)
@@ -94,10 +89,10 @@ void diff_merges_set_dense_combined_if_unset(struct rev_info *revs)
void diff_merges_setup_revs(struct rev_info *revs)
{
- if (revs->combine_merges && revs->ignore_merges < 0)
- revs->ignore_merges = 0;
- if (revs->ignore_merges < 0)
- revs->ignore_merges = 1;
+ if (revs->combine_merges == 0)
+ revs->dense_combined_merges = 0;
+ if (revs->separate_merges == 0)
+ revs->first_parent_merges = 0;
if (revs->combined_all_paths && !revs->combine_merges)
die("--combined-all-paths makes no sense without -c or --cc");
if (revs->combine_merges) {
diff --git a/log-tree.c b/log-tree.c
index 3fdc0fc64b..f9385b1dae 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -918,14 +918,15 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
/* More than one parent? */
if (parents->next) {
- if (opt->ignore_merges)
- return 0;
- else if (opt->combine_merges)
+ if (opt->combine_merges)
return do_diff_combined(opt, commit);
- else if (!opt->first_parent_merges) {
- /* If we show multiple diffs, show the parent info */
- log->parent = parents->item;
- }
+ if (opt->separate_merges) {
+ if (!opt->first_parent_merges) {
+ /* Show parent info for multiple diffs */
+ log->parent = parents->item;
+ }
+ } else
+ return 0;
}
showed_log = 0;
diff --git a/revision.h b/revision.h
index ba2aef7921..fcc532c873 100644
--- a/revision.h
+++ b/revision.h
@@ -191,12 +191,13 @@ struct rev_info {
match_missing:1,
no_commit_id:1,
verbose_header:1,
+ explicit_diff_merges: 1,
+ separate_merges: 1,
combine_merges:1,
combined_all_paths:1,
dense_combined_merges:1,
first_parent_merges:1,
always_show_header:1;
- int ignore_merges:2;
/* Format info */
int show_notes;