Merge "Replace Pakaran with Punjabi"
[lhc/web/wiklou.git] / includes / GitInfo.php
index a54b807..f49f9be 100644 (file)
@@ -162,7 +162,7 @@ class GitInfo {
        /**
         * Get an URL to a web viewer link to the HEAD revision.
         *
-        * @return string|bool string if an URL is available or false otherwise.
+        * @return string|bool string if a URL is available or false otherwise.
         */
        public function getHeadViewUrl() {
                $config = "{$this->basedir}/config";
@@ -194,12 +194,13 @@ class GitInfo {
                }
                foreach ( self::getViewers() as $repo => $viewer ) {
                        $pattern = '#^' . $repo . '$#';
-                       if ( preg_match( $pattern, $url ) ) {
+                       if ( preg_match( $pattern, $url, $matches ) ) {
                                $viewerUrl = preg_replace( $pattern, $viewer, $url );
                                $headSHA1 = $this->getHeadSHA1();
                                $replacements = array(
                                        '%h' => substr( $headSHA1, 0, 7 ),
-                                       '%H' => $headSHA1
+                                       '%H' => $headSHA1,
+                                       '%r' => urlencode( $matches[1] ),
                                );
                                return strtr( $viewerUrl, $replacements );
                        }