1 #include "diff-merges.h"
5 static void suppress(struct rev_info *revs)
7 revs->ignore_merges = 1;
8 revs->first_parent_merges = 0;
9 revs->combine_merges = 0;
10 revs->dense_combined_merges = 0;
13 static void set_dense_combined(struct rev_info *revs)
15 revs->combine_merges = 1;
16 revs->dense_combined_merges = 1;
21 * Public functions. They are in the order they are called.
24 void diff_merges_init_revs(struct rev_info *revs)
26 revs->ignore_merges = -1;
29 int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
33 const char *arg = argv[0];
35 if (!strcmp(arg, "-m")) {
37 * To "diff-index", "-m" means "match missing", and to the "log"
38 * family of commands, it means "show full diff for merges". Set
39 * both fields appropriately.
41 revs->ignore_merges = 0;
42 revs->match_missing = 1;
43 } else if (!strcmp(arg, "-c")) {
45 revs->dense_combined_merges = 0;
46 revs->combine_merges = 1;
47 } else if (!strcmp(arg, "--cc")) {
49 set_dense_combined(revs);
50 } else if (!strcmp(arg, "--no-diff-merges")) {
52 } else if (!strcmp(arg, "--combined-all-paths")) {
54 revs->combined_all_paths = 1;
55 } else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) {
56 if (!strcmp(optarg, "off")) {
59 die(_("unknown value for --diff-merges: %s"), optarg);
67 void diff_merges_suppress(struct rev_info *revs)
72 void diff_merges_default_to_first_parent(struct rev_info *revs)
74 if (revs->ignore_merges < 0) /* No -m */
75 revs->ignore_merges = 0;
78 void diff_merges_default_to_dense_combined(struct rev_info *revs)
80 if (revs->ignore_merges < 0) { /* No -m */
81 revs->ignore_merges = 0;
82 if (!revs->combine_merges) { /* No -c/--cc" */
83 revs->combine_merges = 1;
84 revs->dense_combined_merges = 1;
89 void diff_merges_set_dense_combined_if_unset(struct rev_info *revs)
91 if (!revs->combine_merges)
92 set_dense_combined(revs);
95 void diff_merges_setup_revs(struct rev_info *revs)
97 if (revs->combine_merges && revs->ignore_merges < 0)
98 revs->ignore_merges = 0;
99 if (revs->ignore_merges < 0)
100 revs->ignore_merges = 1;
101 if (revs->combined_all_paths && !revs->combine_merges)
102 die("--combined-all-paths makes no sense without -c or --cc");