X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FViewDiff.pm;h=e9a7bf69969e2c993bba545bcfc7ed5e974249ea;hb=2ad73a71e64085e7814df8880f90120c87d515cb;hp=536bb9e3c99e458e486e96f0abdb2fa9eca83637;hpb=c8e8c8107913df9c67c5eeee86d20f633d11a6d4;p=public-inbox.git diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index 536bb9e3..e9a7bf69 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2020 all contributors +# Copyright (C) 2019-2021 all contributors # License: AGPL-3.0+ # # used by PublicInbox::View @@ -18,8 +18,8 @@ use PublicInbox::Git qw(git_unquote); sub UNSAFE () { "^A-Za-z0-9\-\._~/" } -my $OID_NULL = '0{7,40}'; -my $OID_BLOB = '[a-f0-9]{7,40}'; +my $OID_NULL = '0{7,}'; +my $OID_BLOB = '[a-f0-9]{7,}'; my $LF = qr!\n!; my $ANY = qr![^\n]!; my $FN = qr!(?:"?[^/\n]+/[^\n]+|/dev/null)!; @@ -30,7 +30,7 @@ my $DIFFSTAT_COMMENT = my $NULL_TO_BLOB = qr/^(index $OID_NULL\.\.)($OID_BLOB)\b/ms; my $BLOB_TO_NULL = qr/^index ($OID_BLOB)(\.\.$OID_NULL)\b/ms; my $BLOB_TO_BLOB = qr/^index ($OID_BLOB)\.\.($OID_BLOB)/ms; -my $EXTRACT_DIFFS = qr/( +our $EXTRACT_DIFFS = qr/( (?: # begin header stuff, don't capture filenames, here, # but instead wait for the --- and +++ lines. (?:^diff\x20--git\x20$FN\x20$FN$LF) @@ -41,7 +41,7 @@ my $EXTRACT_DIFFS = qr/( ^index\x20($OID_BLOB)\.\.($OID_BLOB)$ANY*$LF ^---\x20($FN)$LF ^\+{3}\x20($FN)$LF)/msx; -my $IS_OID = qr/\A$OID_BLOB\z/s; +our $IS_OID = qr/\A$OID_BLOB\z/s; # link to line numbers in blobs sub diff_hunk ($$$$) {