summaryrefslogtreecommitdiffstats
path: root/range-diff.h
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2021-01-27 17:37:22 +0100
committerJunio C Hamano <gitster@pobox.com>2021-01-28 07:01:49 +0100
commit679b5916cdafdcfa9fb36c31dbf53d7e4aa0af0b (patch)
treed3ad427618e272cc05cc4c8924f0ff3114612d04 /range-diff.h
parentThe third batch (diff)
downloadgit-679b5916cdafdcfa9fb36c31dbf53d7e4aa0af0b.tar.xz
git-679b5916cdafdcfa9fb36c31dbf53d7e4aa0af0b.zip
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>
Diffstat (limited to 'range-diff.h')
-rw-r--r--range-diff.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/range-diff.h b/range-diff.h
index 583ced2e8e..c17dbc2e75 100644
--- a/range-diff.h
+++ b/range-diff.h
@@ -16,4 +16,12 @@ int show_range_diff(const char *range1, const char *range2,
const struct diff_options *diffopt,
const struct strvec *other_arg);
+/*
+ * Determine whether the given argument is usable as a range argument of `git
+ * range-diff`, e.g. A..B. Note that this only validates the format but does
+ * _not_ parse it, i.e. it does _not_ look up the specified commits in the
+ * local repository.
+ */
+int is_range_diff_range(const char *arg);
+
#endif