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 --- builtin/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/log.c') diff --git a/builtin/log.c b/builtin/log.c index f23ccdbec3..91466c059c 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1680,7 +1680,7 @@ static void infer_range_diff_ranges(struct strbuf *r1, struct commit *head) { const char *head_oid = oid_to_hex(&head->object.oid); - int prev_is_range = !!strstr(prev, ".."); + int prev_is_range = is_range_diff_range(prev); if (prev_is_range) strbuf_addstr(r1, prev); -- cgit v1.2.3