my $PATH_A = '"?a/.+|/dev/null';
my $PATH_B = '"?b/.+|/dev/null';
+# cf. git diff.c :: get_compact_summary
+my $DIFFSTAT_COMMENT = qr/\((?:new|gone|(?:(?:new|mode) [\+\-][lx]))\)/;
+
sub to_html ($$) {
$_[0]->linkify_1($_[1]);
$_[0]->linkify_2(ascii_html($_[1]));
(defined($spfx) && defined($oid_a) && defined($oid_b)) or
return "@@ $ca $cb @@";
- my ($n) = ($ca =~ /^-(\d+)/);
+ my ($n) = ($ca =~ /^-([0-9]+)/);
$n = defined($n) ? do { ++$n; "#n$n" } : '';
my $rv = qq(@@ <a\nhref="$spfx$oid_a/s/$dctx->{Q}$n">$ca</a>);
- ($n) = ($cb =~ /^\+(\d+)/);
+ ($n) = ($cb =~ /^\+([0-9]+)/);
$n = defined($n) ? do { ++$n; "#n$n" } : '';
$rv .= qq( <a\nhref="$spfx$oid_b/s/$dctx->{Q}$n">$cb</a> @@);
# So only do best-effort handling of renames for common cases;
# which works well in practice. If projects put "=>", or trailing
# spaces in filenames, oh well :P
- $fn =~ s/ +\z//s;
+ $fn =~ s/(?: *$DIFFSTAT_COMMENT)? *\z//so;
$fn =~ s/{(?:.+) => (.+)}/$1/ or $fn =~ s/.* => (.+)/$1/;
$fn = git_unquote($fn);