1 #include "diff-merges.h"
6 * Public functions. They are in the order they are called.
9 void diff_merges_init_revs(struct rev_info
*revs
)
11 revs
->ignore_merges
= -1;
14 int diff_merges_parse_opts(struct rev_info
*revs
, const char **argv
)
18 const char *arg
= argv
[0];
20 if (!strcmp(arg
, "-m")) {
22 * To "diff-index", "-m" means "match missing", and to the "log"
23 * family of commands, it means "show full diff for merges". Set
24 * both fields appropriately.
26 revs
->ignore_merges
= 0;
27 revs
->match_missing
= 1;
28 } else if (!strcmp(arg
, "-c")) {
30 revs
->dense_combined_merges
= 0;
31 revs
->combine_merges
= 1;
32 } else if (!strcmp(arg
, "--cc")) {
34 revs
->dense_combined_merges
= 1;
35 revs
->combine_merges
= 1;
36 } else if (!strcmp(arg
, "--no-diff-merges")) {
37 revs
->ignore_merges
= 1;
38 } else if (!strcmp(arg
, "--combined-all-paths")) {
40 revs
->combined_all_paths
= 1;
41 } else if ((argcount
= parse_long_opt("diff-merges", argv
, &optarg
))) {
42 if (!strcmp(optarg
, "off")) {
43 revs
->ignore_merges
= 1;
45 die(_("unknown value for --diff-merges: %s"), optarg
);
53 void diff_merges_default_to_first_parent(struct rev_info
*revs
)
55 if (revs
->ignore_merges
< 0) /* No -m */
56 revs
->ignore_merges
= 0;
59 void diff_merges_default_to_dense_combined(struct rev_info
*revs
)
61 if (revs
->ignore_merges
< 0) { /* No -m */
62 revs
->ignore_merges
= 0;
63 if (!revs
->combine_merges
) { /* No -c/--cc" */
64 revs
->combine_merges
= 1;
65 revs
->dense_combined_merges
= 1;
70 void diff_merges_setup_revs(struct rev_info
*revs
)
72 if (revs
->combine_merges
&& revs
->ignore_merges
< 0)
73 revs
->ignore_merges
= 0;
74 if (revs
->ignore_merges
< 0)
75 revs
->ignore_merges
= 1;
76 if (revs
->combined_all_paths
&& !revs
->combine_merges
)
77 die("--combined-all-paths makes no sense without -c or --cc");