From 359f0d754ab709c5a1ff3267bc117fb8559c62c2 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 5 Feb 2021 14:44:48 +0000 Subject: range-diff/format-patch: handle commit ranges other than A..B In the `SPECIFYING RANGES` section of gitrevisions[7], two ways are described to specify commit ranges that `range-diff` does not yet accept: "^!" and "^-". Let's accept them, by parsing them via the revision machinery and looking for at least one interesting and one uninteresting revision in the resulting `pending` array. This also finally lets us reject arguments that _do_ contain `..` but are not actually ranges, e.g. `HEAD^{/do.. match this}`. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3206-range-diff.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 't/t3206-range-diff.sh') diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index 6eb344be03..2b518378d4 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -150,6 +150,19 @@ test_expect_success 'simple A B C (unmodified)' ' test_cmp expect actual ' +test_expect_success 'A^! and A^- (unmodified)' ' + git range-diff --no-color topic^! unmodified^-1 >actual && + cat >expect <<-EOF && + 1: $(test_oid t4) = 1: $(test_oid u4) s/12/B/ + EOF + test_cmp expect actual +' + +test_expect_success 'A^{/..} is not mistaken for a range' ' + test_must_fail git range-diff topic^.. topic^{/..} 2>error && + test_i18ngrep "not a commit range" error +' + test_expect_success 'trivial reordering' ' git range-diff --no-color master topic reordered >actual && cat >expect <<-EOF && -- cgit 1.2.3-korg