Thread (9 messages) flat view 9 messages, 3 authors, 2016-06-15

Re: [PATCH] Improve contrib/diff-highlight to highlight unevenly-sized hunks

From: Patrick Palka <hidden>
Date: 2016-06-15 23:05:23

Possibly related (same subject, not in this thread)

On Thu, Jun 18, 2015 at 5:23 PM, Jeff King [off-list ref] wrote:
On Thu, Jun 18, 2015 at 04:45:05PM -0400, Jeff King wrote:
quoted
Still, I think this is probably a minority case, and it may be
outweighed by the improvements. The "real" solution is to consider the
hunk as a whole and do an LCS diff on it, which would show that yes,
it's worth highlighting both of those spots, as they are a small
percentage of the total hunk.
I've been meaning to play with this for years, so I took the opportunity
to spend a little time on it. :)
Cool!
Below is a (slightly hacky) patch I came up with. It seems to work, and
produces really great output in some cases. For instance, in 99a2cfb, it
produces (I put highlighted bits in angle brackets):

  -               <hash>cpy(peeled, <sha1>);
  +               <oid>cpy(<&>peeled, <oid>);

It also produces nonsense like:

  -       <un>s<ign>ed <char >peeled<[20]>;
  +       s<truct obj>e<ct_i>d peeled;
That's not even so bad.  The diff of the change itself is... interesting.
but I think that is simply because my splitting function is terrible (it
splits each byte, whereas we'd probably want to use whitespace and
punctuation, or something content-specific).
I hope you can polish this.  It definitely has potential.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help