diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2017-08-15 18:27:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-16 11:44:00 -0700 |
commit | f0b8fb6e591b50b72b921f2c4cf120ebd284f510 (patch) | |
tree | ea681638a57ff4c00e3a9525fa85cfa99e7b0bde /diff.h | |
parent | 09153277f8948d3ed8cb6712f135a9caeaa006f6 (diff) | |
download | git-f0b8fb6e591b50b72b921f2c4cf120ebd284f510.tar.gz |
diff: define block by number of alphanumeric charsjt/diff-color-move-fix
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 'diff.h')
-rw-r--r-- | diff.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -195,7 +195,7 @@ struct diff_options { COLOR_MOVED_ZEBRA_DIM = 3, } color_moved; #define COLOR_MOVED_DEFAULT COLOR_MOVED_ZEBRA - #define COLOR_MOVED_MIN_BLOCK_LENGTH 3 + #define COLOR_MOVED_MIN_ALNUM_COUNT 20 }; void diff_emit_submodule_del(struct diff_options *o, const char *line); |