makes gitweb URL points to full sha1
authorAntoine Musso <hashar@free.fr>
Tue, 10 Apr 2012 20:20:15 +0000 (22:20 +0200)
committerAntoine Musso <hashar@free.fr>
Tue, 10 Apr 2012 20:20:15 +0000 (22:20 +0200)
The URL we are crafting are using a short sha1 (7 chars long) which can
have some good chance of pointing to two different sha1. I have seen git
log to use 8 chars from time to time because of sha1 collisions, 62
occurences outu of 45315 commits as of now.

So to play it safe, this patch makes the URL points to the full sha1.

Follow https://gerrit.wikimedia.org/r/4335
5734eac351dcd72f493bfd7547a5f638f582b048 (commit)
9afc1eff1c396a4d0273d2226e316cba2fb44ab0 (merge)

Change-Id: Ic65d0ca89916fe43999b9e3f257d9f322198f9f8

includes/GitInfo.php

index 595043a..c2066ae 100644 (file)
@@ -29,8 +29,8 @@ class GitInfo {
         * full SHA-1 of the HEAD revision.
         */
        protected $viewers = array(
-               'https://gerrit.wikimedia.org/r/p/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%h',
-               'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%h',
+               'https://gerrit.wikimedia.org/r/p/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H',
+               'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H',
        );
 
        /**