+ $rv .= qq( <a\nhref="$spfx$oid_b/s/$dctx->{Q}$n">$cb</a> @@);
+}
+
+sub oid ($$$) {
+ my ($dctx, $spfx, $oid) = @_;
+ defined($spfx) ? qq(<a\nhref="$spfx$oid/s/$dctx->{Q}">$oid</a>) : $oid;
+}
+
+sub to_state ($$$) {
+ my ($dst, $state, $new_state) = @_;
+ $$dst .= '</span>' if $state2class[$state];
+ $_[1] = $new_state;
+ my $class = $state2class[$new_state] or return;
+ $$dst .= qq(<span\nclass="$class">);
+}
+
+sub anchor0 ($$$$$) {
+ my ($dst, $ctx, $linkify, $fn, $rest) = @_;
+
+ my $orig = $fn;
+
+ # normal git diffstat output is impossible to parse reliably
+ # without --numstat, and that isn't the default for format-patch.
+ # 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/(?: *$DIFFSTAT_COMMENT)? *\z//so;
+ $fn =~ s/{(?:.+) => (.+)}/$1/ or $fn =~ s/.* => (.+)/$1/;
+ $fn = git_unquote($fn);
+
+ # long filenames will require us to walk backwards in anchor1
+ if ($fn =~ s!\A\.\.\./?!!) {
+ my $lp = $ctx->{-long_path} ||= {};
+ $lp->{$fn} = qr/\Q$fn\E\z/s;
+ }
+
+ if (my $attr = to_attr($ctx->{-apfx}.$fn)) {
+ $ctx->{-anchors}->{$attr} = 1;
+ my $spaces = ($orig =~ s/( +)\z//) ? $1 : '';
+ $$dst .= " <a\nid=i$attr\nhref=#$attr>" .
+ ascii_html($orig) . '</a>' . $spaces .
+ $linkify->to_html($rest);
+ return 1;
+ }
+ undef;