X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FGitInfo.php;h=c3c307336ea55455ebc54aa26e1dce802578ff98;hb=3e0b39d59c6ff3e097f692739b6dffa5f7709fbb;hp=74c07ccafcb8590c23cb53b706b0a03189e50e44;hpb=254ea10d4655d412a83c43d6eca4210c459bd1df;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GitInfo.php b/includes/GitInfo.php index 74c07ccafc..c3c307336e 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -5,6 +5,21 @@ * of anyone working on large branches in git to setup config that show up only * when specific branches are currently checked out. * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * * @file */ @@ -70,7 +85,7 @@ class GitInfo { if ( preg_match( "/ref: (.*)/", $HEAD, $m ) ) { return rtrim( $m[1] ); } else { - return $HEAD; + return rtrim( $HEAD ); } } @@ -187,20 +202,10 @@ class GitInfo { * @return array */ protected static function getViewers() { - if( self::$viewers === false ) { - - // Map of repo URLs to viewer URLs. - // - // Key is a pattern passed to preg_match() and preg_replace(), - // without the delimiters (which are #) and must match the whole URL. - // The value is the replacement for the key (it can contain $1, etc.) - // %h will be replaced by the short SHA-1 (7 first chars) and %H by the - // full SHA-1 of the HEAD revision. - self::$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', - ); + global $wgGitRepositoryViewers; + if( self::$viewers === false ) { + self::$viewers = $wgGitRepositoryViewers; wfRunHooks( 'GitViewers', array( &self::$viewers ) ); }