aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-04-21 12:12:25 -0700
committerJunio C Hamano <gitster@pobox.com>2015-04-21 12:12:25 -0700
commitd544696afab635005503b18d71ca150b53d788a4 (patch)
tree0bfded7375b1b85dc2e4b67952beb19a798c4284 /contrib
parentd3115a35fc29e7a55131a677878e67725d4cc165 (diff)
parent8d00662d7d263448d90637ef6758fd2a0b526fec (diff)
downloadgit-d544696afab635005503b18d71ca150b53d788a4.tar.gz
git-d544696afab635005503b18d71ca150b53d788a4.tar.xz
Merge branch 'jk/colors' into maint
"diff-highlight" (in contrib/) used to show byte-by-byte differences, which meant that multi-byte characters can be chopped in the middle. It learned to pay attention to character boundaries (assuming the UTF-8 payload). * jk/colors: diff-highlight: do not split multibyte characters
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/diff-highlight/diff-highlight9
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/diff-highlight/diff-highlight b/contrib/diff-highlight/diff-highlight
index 08c88bbc8..ffefc31a9 100755
--- a/contrib/diff-highlight/diff-highlight
+++ b/contrib/diff-highlight/diff-highlight
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+use 5.008;
use warnings FATAL => 'all';
use strict;
@@ -164,8 +165,12 @@ sub highlight_pair {
sub split_line {
local $_ = shift;
- return map { /$COLOR/ ? $_ : (split //) }
- split /($COLOR*)/;
+ return utf8::decode($_) ?
+ map { utf8::encode($_); $_ }
+ map { /$COLOR/ ? $_ : (split //) }
+ split /($COLOR+)/ :
+ map { /$COLOR/ ? $_ : (split //) }
+ split /($COLOR+)/;
}
sub highlight_line {