1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 22:40:55 +01:00

Handle the case when a repository was deleted

Summary:
when a repository was deleted,
PhabricatorObjectHandleData::loadHandles() is throwing exception because
it assumes that the repository for the commit exists.

Test Plan: try an revision whose repo was deleted and it renders.
Reviewed By: epriestley
Reviewers: epriestley, andrewjcg
CC: aran, epriestley
Differential Revision: 576
This commit is contained in:
Jason Ge 2011-07-01 19:02:27 -07:00
parent af107cff65
commit cd47271cf5

View file

@ -210,14 +210,22 @@ class PhabricatorObjectHandleData {
$repository = $repositories[$repository_ids[$phid]];
$commit_identifier = $commit->getCommitIdentifier();
$vcs = $repository->getVersionControlSystem();
if ($vcs == PhabricatorRepositoryType::REPOSITORY_TYPE_GIT) {
$short_identifier = substr($commit_identifier, 0, 16);
// In case where the repository for the commit was deleted,
// we don't have have info about the repository anymore.
if ($repository) {
$vcs = $repository->getVersionControlSystem();
if ($vcs == PhabricatorRepositoryType::REPOSITORY_TYPE_GIT) {
$short_identifier = substr($commit_identifier, 0, 16);
} else {
$short_identifier = $commit_identifier;
}
$handle->setName('r'.$callsign.$short_identifier);
} else {
$short_identifier = $commit_identifier;
$handle->setName('Commit '.'r'.$callsign.$commit_identifier);
}
$handle->setName('r'.$callsign.$short_identifier);
$handle->setURI('/r'.$callsign.$commit_identifier);
$handle->setFullName('r'.$callsign.$commit_identifier);
$handle->setTimestamp($commit->getEpoch());