1 #include "diff-merges.h"
5 void diff_merges_init_revs(struct rev_info *revs)
7 revs->ignore_merges = -1;
10 int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
14 const char *arg = argv[0];
16 if (!strcmp(arg, "-m")) {
18 * To "diff-index", "-m" means "match missing", and to the "log"
19 * family of commands, it means "show full diff for merges". Set
20 * both fields appropriately.
22 revs->ignore_merges = 0;
23 revs->match_missing = 1;
24 } else if (!strcmp(arg, "-c")) {
26 revs->dense_combined_merges = 0;
27 revs->combine_merges = 1;
28 } else if (!strcmp(arg, "--cc")) {
30 revs->dense_combined_merges = 1;
31 revs->combine_merges = 1;
32 } else if (!strcmp(arg, "--no-diff-merges")) {
33 revs->ignore_merges = 1;
34 } else if (!strcmp(arg, "--combined-all-paths")) {
36 revs->combined_all_paths = 1;
37 } else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) {
38 if (!strcmp(optarg, "off")) {
39 revs->ignore_merges = 1;
41 die(_("unknown value for --diff-merges: %s"), optarg);
49 void diff_merges_setup_revs(struct rev_info *revs)
51 if (revs->combine_merges && revs->ignore_merges < 0)
52 revs->ignore_merges = 0;
53 if (revs->ignore_merges < 0)
54 revs->ignore_merges = 1;
55 if (revs->combined_all_paths && !revs->combine_merges)
56 die("--combined-all-paths makes no sense without -c or --cc");
59 void diff_merges_default_to_first_parent(struct rev_info *revs)
61 if (revs->ignore_merges < 0) /* No -m */
62 revs->ignore_merges = 0;
65 void diff_merges_default_to_dense_combined(struct rev_info *revs)
67 if (revs->ignore_merges < 0) { /* No -m */
68 revs->ignore_merges = 0;
69 if (!revs->combine_merges) { /* No -c/--cc" */
70 revs->combine_merges = 1;
71 revs->dense_combined_merges = 1;