Brian Henderson <henderson.bj@xxxxxxxxx> writes: > --- > contrib/diff-highlight/diff-highlight | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/contrib/diff-highlight/diff-highlight b/contrib/diff-highlight/diff-highlight > index ffefc31..ec31356 100755 > --- a/contrib/diff-highlight/diff-highlight > +++ b/contrib/diff-highlight/diff-highlight > @@ -20,6 +20,7 @@ my @NEW_HIGHLIGHT = ( > my $RESET = "\x1b[m"; > my $COLOR = qr/\x1b\[[0-9;]*m/; > my $BORING = qr/$COLOR|\s/; > +my $GRAPH = qr/$COLOR?\|$COLOR?\s+/; I didn't read the other parts (or existing code this patch changes, for that matter) of the series, but this looks like an attempt to catch the leading "|" bar showing direct ancestry. It makes a reader wonder what happens in a mergy histroy, though. I _think_ that the patch portion of "log -p" output would only have "|" and never "\" or "/" that are used to adjust the number of tracks to deal with forks and merges, but perhaps the fact that this code relies on that assumption deserves to be written down here as an in-code comment? > my @removed; > my @added; > @@ -32,12 +33,12 @@ $SIG{PIPE} = 'DEFAULT'; > while (<>) { > if (!$in_hunk) { > print; > - $in_hunk = /^$COLOR*\@/; > + $in_hunk = /^$GRAPH*$COLOR*\@/; > } > - elsif (/^$COLOR*-/) { > + elsif (/^$GRAPH*$COLOR*-/) { > push @removed, $_; > } > - elsif (/^$COLOR*\+/) { > + elsif (/^$GRAPH*$COLOR*\+/) { > push @added, $_; > } > else { > @@ -46,7 +47,7 @@ while (<>) { > @added = (); > > print; > - $in_hunk = /^$COLOR*[\@ ]/; > + $in_hunk = /^$GRAPH*$COLOR*[\@ ]/; > } > > # Most of the time there is enough output to keep things streaming, > @@ -211,8 +212,8 @@ sub is_pair_interesting { > my $suffix_a = join('', @$a[($sa+1)..$#$a]); > my $suffix_b = join('', @$b[($sb+1)..$#$b]); > > - return $prefix_a !~ /^$COLOR*-$BORING*$/ || > - $prefix_b !~ /^$COLOR*\+$BORING*$/ || > + return $prefix_a !~ /^$GRAPH*$COLOR*-$BORING*$/ || > + $prefix_b !~ /^$GRAPH*$COLOR*\+$BORING*$/ || > $suffix_a !~ /^$BORING*$/ || > $suffix_b !~ /^$BORING*$/; > } -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html