Skip to content

Commit

Permalink
Merge branch 'jc/format-patch-more-aggressive-range-diff' into next
Browse files Browse the repository at this point in the history
The default "creation-factor" used by "git format-patch" has been
raised to make it more aggressively find matching commits.

* jc/format-patch-more-aggressive-range-diff:
  format-patch: run range-diff with larger creation-factor
  • Loading branch information
gitster committed May 22, 2024
2 parents 9bbb973 + c22d41d commit 899cce9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Documentation/git-format-patch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ material (this may change in the future).
between the previous and current series of patches by adjusting the
creation/deletion cost fudge factor. See linkgit:git-range-diff[1])
for details.
+
Defaults to 999 (the linkgit:git-range-diff[1] uses 60), as the use
case is to show comparison with an older iteration of the same
topic and the tool should find more correspondence between the two
sets of patches.

--notes[=<ref>]::
--no-notes::
Expand Down
2 changes: 1 addition & 1 deletion builtin/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
}

if (creation_factor < 0)
creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT;
creation_factor = CREATION_FACTOR_FOR_THE_SAME_SERIES;
else if (!rdiff_prev)
die(_("the option '%s' requires '%s'"), "--creation-factor", "--range-diff");

Expand Down
6 changes: 6 additions & 0 deletions range-diff.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

#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;
Expand Down

0 comments on commit 899cce9

Please sign in to comment.