<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/contrib/diff-highlight, branch v2.13.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.13.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.13.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-08-31T16:59:53Z</updated>
<entry>
<title>diff-highlight: avoid highlighting combined diffs</title>
<updated>2016-08-31T16:59:53Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-08-31T05:05:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3dbfe2b8ae94cbdae5f3d32581aedaa5510fdc87'/>
<id>urn:sha1:3dbfe2b8ae94cbdae5f3d32581aedaa5510fdc87</id>
<content type='text'>
The algorithm in diff-highlight only understands how to look
at two sides of a diff; it cannot correctly handle combined
diffs with multiple preimages. Often highlighting does not
trigger at all for these diffs because the line counts do
not match up.  E.g., if we see:

  - ours
   -theirs
  ++resolved

we would not bother highlighting; it naively looks like a
single line went away, and then a separate hunk added
another single line.

But of course there are exceptions. E.g., if the other side
deleted the line, we might see:

  - ours
  ++resolved

which looks like we dropped " ours" and added "+resolved".
This is only a small highlighting glitch (we highlight the
space and the "+" along with the content), but it's also the
tip of the iceberg. Even if we learned to find the true
content here (by noticing we are in a 3-way combined diff
and marking _two_ characters from the front of the line as
uninteresting), there are other more complicated cases where
we really do need to handle a 3-way hunk.

Let's just punt for now; we can recognize combined diffs by
the presence of extra "@" symbols in the hunk header, and
treat them as non-diff content.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff-highlight: add multi-byte tests</title>
<updated>2016-08-31T16:58:43Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-08-31T05:03:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1b5290b125fca91f620aadbc1a5e3c559d4a5313'/>
<id>urn:sha1:1b5290b125fca91f620aadbc1a5e3c559d4a5313</id>
<content type='text'>
Now that we have a test suite for diff highlight, we can
show off the improvements from 8d00662 (diff-highlight: do
not split multibyte characters, 2015-04-03).

While we're at it, we can also add another case that
_doesn't_ work: combining code points are treated as their
own unit, which means that we may stick colors between them
and the character they are modifying (with the result that
the color is not shown in an xterm, though it's possible
that other terminals err the other way, and show the color
but not the accent).  There's no fix here, but let's
document it as a failure.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff-highlight: ignore test cruft</title>
<updated>2016-08-31T16:58:27Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-08-31T05:02:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9f76e520027d1bbe675d44a951da6f0b3cc3b51e'/>
<id>urn:sha1:9f76e520027d1bbe675d44a951da6f0b3cc3b51e</id>
<content type='text'>
These are the same as in the normal t/.gitignore, with the
exception of ".prove", as our Makefile does not support it.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff-highlight: add support for --graph output</title>
<updated>2016-08-29T19:20:50Z</updated>
<author>
<name>Brian Henderson</name>
<email>henderson.bj@gmail.com</email>
</author>
<published>2016-08-29T17:33:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7e4ffb4c1778c725db3db116f016ef2ad1c6d218'/>
<id>urn:sha1:7e4ffb4c1778c725db3db116f016ef2ad1c6d218</id>
<content type='text'>
Signed-off-by: Brian Henderson &lt;henderson.bj@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff-highlight: add failing test for handling --graph output</title>
<updated>2016-08-29T19:20:18Z</updated>
<author>
<name>Brian Henderson</name>
<email>henderson.bj@gmail.com</email>
</author>
<published>2016-08-29T17:33:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=caf5ea707c2a412cdb61ef694678673b4cbec550'/>
<id>urn:sha1:caf5ea707c2a412cdb61ef694678673b4cbec550</id>
<content type='text'>
Signed-off-by: Brian Henderson &lt;henderson.bj@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff-highlight: add some tests</title>
<updated>2016-08-29T19:18:50Z</updated>
<author>
<name>Brian Henderson</name>
<email>henderson.bj@gmail.com</email>
</author>
<published>2016-08-29T17:33:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=23b250ab0f041bba7af4ba8eb1a686f6850677a6'/>
<id>urn:sha1:23b250ab0f041bba7af4ba8eb1a686f6850677a6</id>
<content type='text'>
Signed-off-by: Brian Henderson &lt;henderson.bj@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/colors'</title>
<updated>2015-04-14T18:49:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-04-14T18:49:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7a1aa0c28876e044351e78d8b8ae6cdbb10b5dfe'/>
<id>urn:sha1:7a1aa0c28876e044351e78d8b8ae6cdbb10b5dfe</id>
<content type='text'>
"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
</content>
</entry>
<entry>
<title>diff-highlight: do not split multibyte characters</title>
<updated>2015-04-04T20:03:45Z</updated>
<author>
<name>Kyle J. McKay</name>
<email>mackyle@gmail.com</email>
</author>
<published>2015-04-03T22:15:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8d00662d7d263448d90637ef6758fd2a0b526fec'/>
<id>urn:sha1:8d00662d7d263448d90637ef6758fd2a0b526fec</id>
<content type='text'>
When the input is UTF-8 and Perl is operating on bytes instead of
characters, a diff that changes one multibyte character to another
that shares an initial byte sequence will result in a broken diff
display as the common byte sequence prefix will be separated from
the rest of the bytes in the multibyte character.

For example, if a single line contains only the unicode character
U+C9C4 (encoded as UTF-8 0xEC, 0xA7, 0x84) and that line is then
changed to the unicode character U+C9C0 (encoded as UTF-8 0xEC,
0xA7, 0x80), when operating on bytes diff-highlight will show only
the single byte change from 0x84 to 0x80 thus creating invalid UTF-8
and a broken diff display.

Fix this by putting Perl into character mode when splitting the line
and then back into byte mode after the split is finished.

The utf8::xxx functions require Perl 5.8 so we require that as well.

Also, since we are mucking with code in the split_line function, we
change a '*' quantifier to a '+' quantifier when matching the $COLOR
expression which has the side effect of speeding everything up while
eliminating useless '' elements in the returned array.

Reported-by: Yi EungJun &lt;semtlenori@gmail.com&gt;
Signed-off-by: Kyle J. McKay &lt;mackyle@gmail.com&gt;
Acked-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/colors'</title>
<updated>2014-12-22T20:27:58Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-12-22T20:27:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3dadfc7e173e27db641291d8f049ab487b696704'/>
<id>urn:sha1:3dadfc7e173e27db641291d8f049ab487b696704</id>
<content type='text'>
"diff-highlight" filter (in contrib/) allows its color output
to be customized via configuration variables.

* jk/colors:
  parse_color: drop COLOR_BACKGROUND macro
  diff-highlight: allow configurable colors
  parse_color: recognize "no$foo" to clear the $foo attribute
  parse_color: support 24-bit RGB values
  parse_color: refactor color storage
</content>
</entry>
<entry>
<title>diff-highlight: allow configurable colors</title>
<updated>2014-11-20T20:43:16Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-11-20T15:29:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bca45fbc1f8fe0daa76e840fa2ad4a9c663500a0'/>
<id>urn:sha1:bca45fbc1f8fe0daa76e840fa2ad4a9c663500a0</id>
<content type='text'>
Until now, the highlighting colors were hard-coded in the
script (as "reverse" and "noreverse"), and you had to edit
the script to change them. This patch teaches diff-highlight
to read from color.diff-highlight.* to set them.

In addition, it expands the possiblities considerably by
adding two features:

  1. Old/new lines can be colored independently (so you can
     use a color scheme that complements existing line
     coloring).

  2. Normal, unhighlighted parts of the lines can be colored,
     too. Technically this can be done by separately
     configuring color.diff.old/new and matching it to your
     diff-highlight colors. But you may want a different
     look for your highlighted diffs versus your regular
     diffs.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
