summaryrefslogtreecommitdiff
path: root/Documentation/diff-options.txt
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2017-08-16 01:27:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-16 18:44:00 (GMT)
commitf0b8fb6e591b50b72b921f2c4cf120ebd284f510 (patch)
treeea681638a57ff4c00e3a9525fa85cfa99e7b0bde /Documentation/diff-options.txt
parent09153277f8948d3ed8cb6712f135a9caeaa006f6 (diff)
downloadgit-f0b8fb6e591b50b72b921f2c4cf120ebd284f510.zip
git-f0b8fb6e591b50b72b921f2c4cf120ebd284f510.tar.gz
git-f0b8fb6e591b50b72b921f2c4cf120ebd284f510.tar.bz2
diff: define block by number of alphanumeric chars
The existing behavior of diff --color-moved=zebra does not define the minimum size of a block at all, instead relying on a heuristic applied later to filter out sets of adjacent moved lines that are shorter than 3 lines long. This can be confusing, because a block could thus be colored as moved at the source but not at the destination (or vice versa), depending on its neighbors. Instead, teach diff that the minimum size of a block is 20 alphanumeric characters, the same heuristic used by "git blame". This allows diff to still exclude uninteresting lines appearing on their own (such as those solely consisting of one or a few closing braces), as was the intention of the adjacent-moved-line heuristic. This requires a change in some tests in that some of their lines are no longer considered to be part of a block, because they are too short. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/diff-options.txt')
-rw-r--r--Documentation/diff-options.txt8
1 files changed, 3 insertions, 5 deletions
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index bc52bd0..b8c8816 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -254,13 +254,11 @@ plain::
moved line, but it is not very useful in a review to determine
if a block of code was moved without permutation.
zebra::
- Blocks of moved code are detected greedily. The detected blocks are
+ Blocks of moved text of at least 20 alphanumeric characters
+ are detected greedily. The detected blocks are
painted using either the 'color.diff.{old,new}Moved' color or
'color.diff.{old,new}MovedAlternative'. The change between
- the two colors indicates that a new block was detected. If there
- are fewer than 3 adjacent moved lines, they are not marked up
- as moved, but the regular colors 'color.diff.{old,new}' will be
- used.
+ the two colors indicates that a new block was detected.
dimmed_zebra::
Similar to 'zebra', but additional dimming of uninteresting parts
of moved code is performed. The bordering lines of two adjacent