diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-12-23 09:32:17 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-12-23 09:32:17 -0800 |
| commit | 88e59f8027ed0260584ccc0abd6fe435031614eb (patch) | |
| tree | a416556f6e4279cb7c80ebbb68de1f3b01feecb9 /builtin/range-diff.c | |
| parent | c4cc685a62ffc06c86b1ecd1382c1b5cd0166189 (diff) | |
| parent | 4538338c7edb13a5e818abcfa5739f16ad3dda0c (diff) | |
Merge branch 'js/range-diff-diff-merges'
"git range-diff" learned to optionally show and compare merge
commits in the ranges being compared, with the --diff-merges
option.
* js/range-diff-diff-merges:
range-diff: introduce the convenience option `--remerge-diff`
range-diff: optionally include merge commits' diffs in the analysis
Diffstat (limited to 'builtin/range-diff.c')
| -rw-r--r-- | builtin/range-diff.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/builtin/range-diff.c b/builtin/range-diff.c index 433c305fc5..32ddb6613f 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -22,6 +22,7 @@ int cmd_range_diff(int argc, { struct diff_options diffopt = { NULL }; struct strvec other_arg = STRVEC_INIT; + struct strvec diff_merges_arg = STRVEC_INIT; struct range_diff_options range_diff_opts = { .creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT, .diffopt = &diffopt, @@ -37,6 +38,10 @@ int cmd_range_diff(int argc, OPT_PASSTHRU_ARGV(0, "notes", &other_arg, N_("notes"), N_("passed to 'git log'"), PARSE_OPT_OPTARG), + OPT_PASSTHRU_ARGV(0, "diff-merges", &diff_merges_arg, + N_("style"), N_("passed to 'git log'"), 0), + OPT_PASSTHRU_ARGV(0, "remerge-diff", &diff_merges_arg, NULL, + N_("passed to 'git log'"), PARSE_OPT_NOARG), OPT_BOOL(0, "left-only", &left_only, N_("only emit output related to the first range")), OPT_BOOL(0, "right-only", &right_only, @@ -63,6 +68,12 @@ int cmd_range_diff(int argc, if (!simple_color) diffopt.use_color = 1; + /* If `--diff-merges` was specified, imply `--merges` */ + if (diff_merges_arg.nr) { + range_diff_opts.include_merges = 1; + strvec_pushv(&other_arg, diff_merges_arg.v); + } + for (i = 0; i < argc; i++) if (!strcmp(argv[i], "--")) { dash_dash = i; @@ -156,6 +167,7 @@ int cmd_range_diff(int argc, res = show_range_diff(range1.buf, range2.buf, &range_diff_opts); strvec_clear(&other_arg); + strvec_clear(&diff_merges_arg); strbuf_release(&range1); strbuf_release(&range2); |
