Skip to content

Commit 2566865

Browse files
sunshinecogitster
authored andcommitted
range-diff: publish default creation factor
The range-diff back-end allows its heuristic to be tweaked via the "creation factor". git-range-diff, the only client of the back-end, defaults the factor to 60% (hard-coded in builtin/range-diff.c), but allows the user to override it with the --creation-factor option. Publish the default range factor to allow new callers of the range-diff back-end to default to the same value without duplicating the hard-coded constant, and to avoid worrying about various callers becoming out-of-sync if the default ever needs to change. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 87f1b2d commit 2566865

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

builtin/range-diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static struct strbuf *output_prefix_cb(struct diff_options *opt, void *data)
1818

1919
int cmd_range_diff(int argc, const char **argv, const char *prefix)
2020
{
21-
int creation_factor = 60;
21+
int creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT;
2222
struct diff_options diffopt = { NULL };
2323
int simple_color = -1;
2424
struct option options[] = {

range-diff.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "diff.h"
55

6+
#define RANGE_DIFF_CREATION_FACTOR_DEFAULT 60
7+
68
int show_range_diff(const char *range1, const char *range2,
79
int creation_factor, struct diff_options *diffopt);
810

0 commit comments

Comments
 (0)