1
0
mirror of https://github.com/git/git synced 2024-06-28 13:44:40 +00:00
git/range-diff.h
Junio C Hamano c22d41d641 format-patch: run range-diff with larger creation-factor
We see too often that a range-diff added to format-patch output
shows too many "unmatched" patches.  This is because the default
value for creation-factor is set to a relatively low value.

It may be justified for other uses (like you have a yet-to-be-sent
new iteration of your series, and compare it against the 'seen'
branch that has an older iteration, probably with the '--left-only'
option, to pick out only your patches while ignoring the others) of
"range-diff" command, but when the command is run as part of the
format-patch, the user _knows_ and expects that the patches in the
old and the new iterations roughly correspond to each other, so we
can and should use a much higher default.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-05-06 11:57:22 -07:00

37 lines
906 B
C

#ifndef RANGE_DIFF_H
#define RANGE_DIFF_H
#include "diff.h"
#include "strvec.h"
#define RANGE_DIFF_CREATION_FACTOR_DEFAULT 60
/*
* A much higher value than the default, when we KNOW we are comparing
* the same series (e.g., used when format-patch calls range-diff).
*/
#define CREATION_FACTOR_FOR_THE_SAME_SERIES 999
struct range_diff_options {
int creation_factor;
unsigned dual_color:1;
unsigned left_only:1, right_only:1;
const struct diff_options *diffopt; /* may be NULL */
const struct strvec *other_arg; /* may be NULL */
};
/*
* Compare series of commits in `range1` and `range2`, and emit to the
* standard output.
*/
int show_range_diff(const char *range1, const char *range2,
struct range_diff_options *opts);
/*
* Determine whether the given argument is usable as a range argument of `git
* range-diff`, e.g. A..B.
*/
int is_range_diff_range(const char *arg);
#endif