dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Remove perf tracking code that was moved to WikimediaEvents in Ib300af5c"
[lhc/web/wiklou.git]
/
includes
/
GitInfo.php
diff --git
a/includes/GitInfo.php
b/includes/GitInfo.php
index
de7e8c2
..
3c600ed
100644
(file)
--- a/
includes/GitInfo.php
+++ b/
includes/GitInfo.php
@@
-46,7
+46,7
@@
class GitInfo {
protected $cache = [];
/**
protected $cache = [];
/**
- * Map of repo URLs to viewer URLs. Access via static method getViewers().
+ *
@var array|false
Map of repo URLs to viewer URLs. Access via static method getViewers().
*/
private static $viewers = false;
*/
private static $viewers = false;
@@
-191,8
+191,14
@@
class GitInfo {
} else {
// If not a SHA1 it may be a ref:
$refFile = "{$this->basedir}/{$head}";
} else {
// If not a SHA1 it may be a ref:
$refFile = "{$this->basedir}/{$head}";
+ $packedRefs = "{$this->basedir}/packed-refs";
+ $headRegex = preg_quote( $head, '/' );
if ( is_readable( $refFile ) ) {
$sha1 = rtrim( file_get_contents( $refFile ) );
if ( is_readable( $refFile ) ) {
$sha1 = rtrim( file_get_contents( $refFile ) );
+ } elseif ( is_readable( $packedRefs ) &&
+ preg_match( "/^([0-9A-Fa-f]{40}) $headRegex$/m", file_get_contents( $packedRefs ), $matches )
+ ) {
+ $sha1 = $matches[1];
}
}
$this->cache['headSHA1'] = $sha1;
}
}
$this->cache['headSHA1'] = $sha1;