mirror of
https://github.com/git/git.git
synced 2026-01-10 01:56:42 +00:00
blame: make diff algorithm configurable
The diff algorithm used in 'git-blame(1)' is set to 'myers', without the possibility to change it aside from the `--minimal` option. There has been long-standing interest in changing the default diff algorithm to "histogram", and Git 3.0 was floated as a possible occasion for taking some steps towards that: https://lore.kernel.org/git/xmqqed873vgn.fsf@gitster.g/ As a preparation for this move, it is worth making sure that the diff algorithm is configurable where useful. Make it configurable in the `git-blame(1)` command by introducing the `--diff-algorithm` option and make honor the `diff.algorithm` config variable. Keep Myers diff as the default. Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
881793c4f7
commit
ffffb987fc
@@ -197,26 +197,7 @@ and starts with _<text>_, this algorithm attempts to prevent it from
|
||||
appearing as a deletion or addition in the output. It uses the "patience
|
||||
diff" algorithm internally.
|
||||
|
||||
`--diff-algorithm=(patience|minimal|histogram|myers)`::
|
||||
Choose a diff algorithm. The variants are as follows:
|
||||
+
|
||||
--
|
||||
`default`;;
|
||||
`myers`;;
|
||||
The basic greedy diff algorithm. Currently, this is the default.
|
||||
`minimal`;;
|
||||
Spend extra time to make sure the smallest possible diff is
|
||||
produced.
|
||||
`patience`;;
|
||||
Use "patience diff" algorithm when generating patches.
|
||||
`histogram`;;
|
||||
This algorithm extends the patience algorithm to "support
|
||||
low-occurrence common elements".
|
||||
--
|
||||
+
|
||||
For instance, if you configured the `diff.algorithm` variable to a
|
||||
non-default value and want to use the default one, then you
|
||||
have to use `--diff-algorithm=default` option.
|
||||
include::diff-algorithm-option.adoc[]
|
||||
|
||||
`--stat[=<width>[,<name-width>[,<count>]]]`::
|
||||
Generate a diffstat. By default, as much space as necessary
|
||||
|
||||
Reference in New Issue
Block a user