- if ($s =~ /^(?:diff|---|\+{3}) /ms) {
- # diffstat anchors do not link across attachments or messages:
- $idx[0] = $upfx . $idx[0] if $upfx ne '';
- $ctx->{-apfx} = join('/', @idx);
- $ctx->{-anchors} = {}; # attr => filename
+ if ($s =~ /^--- [^\n]+\n\+{3} [^\n]+\n@@ /ms) {
+ # diffstat anchors do not link across attachments or messages,
+ # -apfx is just a stable prefix for making diffstat anchors
+ # linkable to the first diff hunk w/o crossing attachments
+ $idx =~ tr!.!/!; # compatibility with previous versions
+ $ctx->{-apfx} = $upfx . $idx;
+
+ # do attr => filename mappings for diffstats in git diffs:
+ $ctx->{-anchors} = {} if $s =~ /^diff --git /sm;