From: Kunal Mehta Date: Wed, 24 Aug 2016 22:44:41 +0000 (-0700) Subject: debug: Don't show git branch if on a detached HEAD X-Git-Tag: 1.31.0-rc.0~5890^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=14037fd04dffae387d149534f1ec71d6574086a3;p=lhc%2Fweb%2Fwiklou.git debug: Don't show git branch if on a detached HEAD The short SHA1 is already shown with the MediaWiki version, and displaying the full SHA1 again adds 40+ more characters. Mostly this annoys me as it causes the toolbar to wrap earlier when making my browser window smaller. Change-Id: If7474a090466de708d65cef6dcc30a36df56621f --- diff --git a/includes/debug/MWDebug.php b/includes/debug/MWDebug.php index 6ce5829388..58387edb5e 100644 --- a/includes/debug/MWDebug.php +++ b/includes/debug/MWDebug.php @@ -525,12 +525,19 @@ class MWDebug { // see: https://github.com/facebook/hhvm/issues/2257#issuecomment-39362246 $realMemoryUsage = wfIsHHVM(); + $branch = GitInfo::currentBranch(); + if ( GitInfo::isSHA1( $branch ) ) { + // If it's a detached HEAD, the SHA1 will already be + // included in the MW version, so don't show it. + $branch = false; + } + return [ 'mwVersion' => $wgVersion, 'phpEngine' => wfIsHHVM() ? 'HHVM' : 'PHP', 'phpVersion' => wfIsHHVM() ? HHVM_VERSION : PHP_VERSION, 'gitRevision' => GitInfo::headSHA1(), - 'gitBranch' => GitInfo::currentBranch(), + 'gitBranch' => $branch, 'gitViewUrl' => GitInfo::headViewUrl(), 'time' => microtime( true ) - $wgRequestTime, 'log' => self::$log,