X-Git-Url: http://git.cyclocoop.org/%22%20.%20%20%20%24self2%20.%20%20%20%22&var_mode_affiche=boucle?a=blobdiff_plain;f=includes%2FGitInfo.php;h=3c600ed984057918d3a7f8c2bb07af0797e8bcbc;hb=505e7ee4039c4448e69f2f522830fb2fbf9235c4;hp=4351acc0e9b85ccf8385ef8a3b59de8f85af0a30;hpb=4cb9c1a24bde6e29c5e8f05c7cd1de54ffdd342a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GitInfo.php b/includes/GitInfo.php index 4351acc0e9..3c600ed984 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -191,8 +191,14 @@ class GitInfo { } 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 ) ); + } 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;