Page MenuHomePhabricator

GitInfo doesn't get SHA1 version of git submodules for Special:Version
Closed, ResolvedPublic

Description

On my local wiki, Special:Version only shows git SHA1 hashes for extensions that have local .git subdirectories because I checked out a particular version. Where I relied on git submodule update --init, the extension's .git is a plain file containing only a gitdir: line, for example extension/Vector/.git contains only

gitdir: /home/spage/projects/core/.git/modules/extensions/Vector

and it is this directory in a parent repository that contains a HEAD file with the commit hash.

Looking at GitInfo.php confirms this. It doesn't do anything special when an extension's .git is a plain file, so fails trying to read "{$dir}/.git/HEAD", and so doesn't retrieve the SHA1.

Looking at strace git rev-parse --short HEAD, I think GitInfo.php should: in _construct() check if .git is a plain file, if so read it, if it contains "gitdir: /some/path" then set $this->basedir to that path.

Fixing this may make Special:Version on WMF wikis return to showing the git SHA1 hashes of extensions.


Version: 1.21.x
Severity: normal

Details

Reference
bz44599