Chad has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/277341

Change subject: Use Diffusion for default Git Viewer
......................................................................

Use Diffusion for default Git Viewer

- Provide new %R parameter for $wgGitRepositoryViewers that gives
  a non-URL-encoded version of the repo name.
- Don't force repos to end in .git. That's not required and never
  has been.
- Finally swap Gitblit urls for Diffusion equivalents

Change-Id: I7d2fb3eea1587be66b88acc6a9b9d17382cb01d5
---
M includes/DefaultSettings.php
M includes/GitInfo.php
2 files changed, 4 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/41/277341/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index c04602c..0a9a29a 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -6238,14 +6238,15 @@
  * %h will be replaced by the short SHA-1 (7 first chars) and %H by the
  * full SHA-1 of the HEAD revision.
  * %r will be replaced with a URL-encoded version of $1.
+ * %R will be replaced with $1 and no URL-encoding
  *
  * @since 1.20
  */
 $wgGitRepositoryViewers = [
        'https://(?:[a-z0-9_]+@)?gerrit.wikimedia.org/r/(?:p/)?(.*)' =>
-               'https://git.wikimedia.org/tree/%r/%H',
+               'https://phabricator.wikimedia.org/r/revision/%R;%H',
        'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' =>
-               'https://git.wikimedia.org/tree/%r/%H',
+               'https://phabricator.wikimedia.org/r/revision/%R;%H',
 ];
 
 /** @} */ # End of maintenance }
diff --git a/includes/GitInfo.php b/includes/GitInfo.php
index 29516ab..de7e8c2 100644
--- a/includes/GitInfo.php
+++ b/includes/GitInfo.php
@@ -257,9 +257,6 @@
                if ( $url === false ) {
                        return false;
                }
-               if ( substr( $url, -4 ) !== '.git' ) {
-                       $url .= '.git';
-               }
                foreach ( self::getViewers() as $repo => $viewer ) {
                        $pattern = '#^' . $repo . '$#';
                        if ( preg_match( $pattern, $url, $matches ) ) {
@@ -269,6 +266,7 @@
                                        '%h' => substr( $headSHA1, 0, 7 ),
                                        '%H' => $headSHA1,
                                        '%r' => urlencode( $matches[1] ),
+                                       '%R' => $matches[1],
                                ];
                                return strtr( $viewerUrl, $replacements );
                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/277341
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7d2fb3eea1587be66b88acc6a9b9d17382cb01d5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to