- my $linkify = $ctx->{-linkify};
- my $dst = $ctx->{obuf};
- if (exists $ctx->{-anchors} && $$x =~ /\A(.*?) # likely "---\n"
- # diffstat lines:
- ((?:^\x20(?:[^\n]+?)(?:\x20+\|\x20[^\n]*\n))+)
- (\x20[0-9]+\x20files?\x20)changed,([^\n]+\n)
- (.*?)\z/msx) { # notes, commit message, etc
- undef $$x;
- my @x = ($5, $4, $3, $2, $1);
- $$dst .= $linkify->to_html(pop @x); # uninteresting prefix
- for my $l (split(/^/m, pop(@x))) { # per-file diffstat lines
+ if (exists $ctx->{-anchors} && $$x =~ # diffstat lines:
+ /((?:^\x20(?:[^\n]+?)(?:\x20+\|\x20[^\n]*\n))+)
+ (\x20[0-9]+\x20files?\x20)changed,/msx) {
+ my $pre = substr($$x, 0, $-[0]); # (likely) short prefix
+ substr($$x, 0, $+[0], ''); # sv_chop on $$x ($$x may be long)
+ my @x = ($2, $1);
+ my $lnk = $ctx->{-linkify};
+ my $zfh = $ctx->{zfh};
+ # uninteresting prefix
+ print $zfh $lnk->to_html($pre);
+ for my $l (split(/^/m, pop(@x))) { # $2 per-file stat lines