1
0
mirror of https://github.com/git/git synced 2024-07-02 15:48:44 +00:00
git/range-diff.h
Johannes Schindelin 679b5916cd 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>
2021-01-27 22:01:49 -08:00

28 lines
779 B
C

#ifndef RANGE_DIFF_H
#define RANGE_DIFF_H
#include "diff.h"
#include "strvec.h"
#define RANGE_DIFF_CREATION_FACTOR_DEFAULT 60
/*
* Compare series of commits in RANGE1 and RANGE2, and emit to the
* standard output. NULL can be passed to DIFFOPT to use the built-in
* default.
*/
int show_range_diff(const char *range1, const char *range2,
int creation_factor, int dual_color,
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