https://bugzilla.wikimedia.org/show_bug.cgi?id=51720

       Web browser: ---
            Bug ID: 51720
           Summary: auto-linking to gerrit commits is too aggressive
           Product: Wikimedia
           Version: wmf-deployment
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: Unprioritized
         Component: Bugzilla
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
    Classification: Unclassified
   Mobile Platform: ---

bugzilla turns a timestamp like 20130718 into a "Git commit" link to a gerrit
query.  See how this messed up e.g. bug 50204 comment 11.

This arises from the regex in
https://git.wikimedia.org/blob/wikimedia%2Fbugzilla%2Fmodifications/HEAD/bugzilla-4.2%2Fextensions%2FWikimedia%2FExtension.pm

   my $replacerGitCommit = {
       match => qr{(?:^|(?<=[\s\[\{\(]))([a-f0-9]{8,40})}i,
       replace => \&_createGitCommitLink
   };

I think the match should require at least one a-f in its hexadecimal digits to
avoid these false matches with large numbers. I don't know if it should require
a digit as well, to avoid turning words like "defaced" into a commit. My perlre
fu is unclear on how to make these assertions. Also, since `git log --oneline`
produces 7-digit commit SHA-1s, the match should start at 7 hex digits.

You could add a match on "qr{(?:commit\s)([a-f0-9]{7,40})}i" so people can
force a link to "commit 1234567".

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to