range-diff/format-patch: refactor check for commit range
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 27 Jan 2021 16:37:22 +0000 (16:37 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Jan 2021 06:01:49 +0000 (22:01 -0800)
commit679b5916cdafdcfa9fb36c31dbf53d7e4aa0af0b
treed3ad427618e272cc05cc4c8924f0ff3114612d04
parent66e871b6647ffea61a77a0f82c7ef3415f1ee79c
range-diff/format-patch: refactor check for commit range

Currently, when called with exactly two arguments, `git range-diff`
tests for a literal `..` in each of the two. Likewise, the argument
provided via `--range-diff` to `git format-patch` is checked in the same
manner.

However, `<commit>^!` is a perfectly valid commit range, equivalent to
`<commit>^..<commit>` according to the `SPECIFYING RANGES` section of
gitrevisions[7].

In preparation for allowing more sophisticated ways to specify commit
ranges, let's refactor the check into its own function.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/log.c
builtin/range-diff.c
range-diff.c
range-diff.h