1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Don't throw an exception if the author of a tag can't be found

Summary:
It's possible to have a tag with no tagger (or git used to allow this),
so some tags (like 26791a8bcf0e6d33f43aef7682bdb555236d56de in the linux
kernel) were causing trouble.

Test Plan:
opened diffusion to a page where I was previously getting a red box complaining
about being unable to parse the output of git for-each-ref.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, vrana

Differential Revision: https://secure.phabricator.com/D2711
This commit is contained in:
Nick Harper 2012-06-11 16:53:52 -07:00
parent a0b57cefb7
commit 865680ad30

View file

@ -49,13 +49,14 @@ final class DiffusionGitTagListQuery extends DiffusionTagListQuery {
$matches = null;
if (!preg_match('/^(.*) ([0-9]+) ([0-9+-]+)$/', $creator, $matches)) {
throw new Exception(
"Unparseable output from 'git for-each-ref': {$line}");
// It's possible a tag doesn't have a creator (tagger)
$author = null;
$epoch = null;
} else {
$author = $matches[1];
$epoch = $matches[2];
}
$author = $matches[1];
$epoch = $matches[2];
$tag = new DiffusionRepositoryTag();
$tag->setAuthor($author);
$tag->setEpoch($epoch);