]> Sergey Matveev's repositories - public-inbox.git/commit
viewdiff: assume diffstat and diff order are identical
authorEric Wong <e@yhbt.net>
Wed, 6 May 2020 10:40:53 +0000 (10:40 +0000)
committerEric Wong <e@yhbt.net>
Thu, 7 May 2020 19:09:41 +0000 (19:09 +0000)
commit65b37aeb8392a62e9aa8ceac08227c77c6fa6b8b
treebc46876af8e9b881a286d4825f89ca261de8f6b8
parent2e168e869df3f1ca88f2eb22a8d1a1dda869b6ef
viewdiff: assume diffstat and diff order are identical

For non-malicious messages, we can assume the diffstat and actual
diff appear in the same order.  Thus we can store {-long_paths} as
an arrayref and only compare the first element when we encounter
a truncated path.

This should make HTML rendering stable when there's basename
conflicts in message such as
https://lore.kernel.org/backports/1393202754-12919-13-git-send-email-hauke@hauke-m.de/

This diffstat anchor linkification can still be defeated by
users who make actual path names beginning with "...", but we
won't waste CPU cycles on it, either.
lib/PublicInbox/ViewDiff.pm