From 679b5916cdafdcfa9fb36c31dbf53d7e4aa0af0b Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 27 Jan 2021 16:37:22 +0000 Subject: 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, `^!` is a perfectly valid commit range, equivalent to `^..` 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 Signed-off-by: Junio C Hamano --- range-diff.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'range-diff.c') diff --git a/range-diff.c b/range-diff.c index b9950f10c8..9b93e08e84 100644 --- a/range-diff.c +++ b/range-diff.c @@ -564,3 +564,8 @@ int show_range_diff(const char *range1, const char *range2, return res; } + +int is_range_diff_range(const char *arg) +{ + return !!strstr(arg, ".."); +} -- cgit v1.2.3