diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2021-02-05 14:46:13 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-06 21:14:31 -0800 |
commit | 1e79f973266cfe0e3bab0e26e869b682078e457d (patch) | |
tree | 419e8d3df016350fa2867d2be741f90385b94fa4 /builtin/range-diff.c | |
parent | 3e6046edadf409537cc9e991d1df628fa96953ba (diff) | |
download | git-1e79f973266cfe0e3bab0e26e869b682078e457d.tar.gz |
range-diff: offer --left-only/--right-only options
When comparing commit ranges, one is frequently interested only in one
side, such as asking the question "Has this patch that I submitted to
the Git mailing list been applied?": one would only care about the part
of the output that corresponds to the commits in a local branch.
To make that possible, imitate the `git rev-list` options `--left-only`
and `--right-only`.
This addresses https://github.com/gitgitgadget/git/issues/206
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/range-diff.c')
-rw-r--r-- | builtin/range-diff.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/builtin/range-diff.c b/builtin/range-diff.c index 73fea79601..930f273b85 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -20,7 +20,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix) .diffopt = &diffopt, .other_arg = &other_arg }; - int simple_color = -1; + int simple_color = -1, left_only = 0, right_only = 0; struct option range_diff_options[] = { OPT_INTEGER(0, "creation-factor", &range_diff_opts.creation_factor, @@ -30,6 +30,10 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix) OPT_PASSTHRU_ARGV(0, "notes", &other_arg, N_("notes"), N_("passed to 'git log'"), PARSE_OPT_OPTARG), + OPT_BOOL(0, "left-only", &left_only, + N_("only emit output related to the first range")), + OPT_BOOL(0, "right-only", &right_only, + N_("only emit output related to the second range")), OPT_END() }; struct option *options; @@ -87,6 +91,8 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix) FREE_AND_NULL(options); range_diff_opts.dual_color = simple_color < 1; + range_diff_opts.left_only = left_only; + range_diff_opts.right_only = right_only; res = show_range_diff(range1.buf, range2.buf, &range_diff_opts); strvec_clear(&other_arg); |