|
|
|
@ -21,6 +21,10 @@ my $RESET = "\x1b[m";
@@ -21,6 +21,10 @@ my $RESET = "\x1b[m";
|
|
|
|
|
my $COLOR = qr/\x1b\[[0-9;]*m/; |
|
|
|
|
my $BORING = qr/$COLOR|\s/; |
|
|
|
|
|
|
|
|
|
# The patch portion of git log -p --graph should only ever have preceding | and |
|
|
|
|
# not / or \ as merge history only shows up on the commit line. |
|
|
|
|
my $GRAPH = qr/$COLOR?\|$COLOR?\s+/; |
|
|
|
|
|
|
|
|
|
my @removed; |
|
|
|
|
my @added; |
|
|
|
|
my $in_hunk; |
|
|
|
@ -32,12 +36,12 @@ $SIG{PIPE} = 'DEFAULT';
@@ -32,12 +36,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 +50,7 @@ while (<>) {
@@ -46,7 +50,7 @@ while (<>) {
|
|
|
|
|
@added = (); |
|
|
|
|
|
|
|
|
|
print; |
|
|
|
|
$in_hunk = /^$COLOR*[\@ ]/; |
|
|
|
|
$in_hunk = /^$GRAPH*$COLOR*[\@ ]/; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Most of the time there is enough output to keep things streaming, |
|
|
|
@ -163,6 +167,9 @@ sub highlight_pair {
@@ -163,6 +167,9 @@ sub highlight_pair {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# we split either by $COLOR or by character. This has the side effect of |
|
|
|
|
# leaving in graph cruft. It works because the graph cruft does not contain "-" |
|
|
|
|
# or "+" |
|
|
|
|
sub split_line { |
|
|
|
|
local $_ = shift; |
|
|
|
|
return utf8::decode($_) ? |
|
|
|
@ -211,8 +218,8 @@ sub is_pair_interesting {
@@ -211,8 +218,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*$/; |
|
|
|
|
} |
|
|
|
|