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

Prevent creation of empty repository identities

Summary: Fixes issue reported in https://secure.phabricator.com/rPf191a66490b194785fae28c062b71be99bb14584#43240

Test Plan: Imported an SVN repo, observed clean import instead of daemon exception.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D19466
This commit is contained in:
Austin McKinley 2018-06-05 15:57:30 -07:00
parent dbe72df557
commit b8b2d1672d

View file

@ -80,6 +80,9 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
->save(); ->save();
} }
$committer_identity = null;
if ($committer) {
$committer_identity = id(new PhabricatorRepositoryIdentityQuery()) $committer_identity = id(new PhabricatorRepositoryIdentityQuery())
->setViewer(PhabricatorUser::getOmnipotentUser()) ->setViewer(PhabricatorUser::getOmnipotentUser())
->withIdentityNames(array($committer)) ->withIdentityNames(array($committer))
@ -93,6 +96,7 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
$this->resolveUserPHID($commit, $committer)) $this->resolveUserPHID($commit, $committer))
->save(); ->save();
} }
}
$data = id(new PhabricatorRepositoryCommitData())->loadOneWhere( $data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
'commitID = %d', 'commitID = %d',
@ -128,6 +132,8 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
$this->resolveUserPHID($commit, $committer)); $this->resolveUserPHID($commit, $committer));
$data->setCommitDetail( $data->setCommitDetail(
'committerIdentityPHID', $committer_identity->getPHID()); 'committerIdentityPHID', $committer_identity->getPHID());
$commit->setCommitterIdentityPHID($committer_identity->getPHID());
} }
$repository = $this->repository; $repository = $this->repository;
@ -166,7 +172,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
} }
$commit->setAuthorIdentityPHID($author_identity->getPHID()); $commit->setAuthorIdentityPHID($author_identity->getPHID());
$commit->setCommitterIdentityPHID($committer_identity->getPHID());
$commit->setSummary($data->getSummary()); $commit->setSummary($data->getSummary());
$commit->save(); $commit->save();