mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 14:30:56 +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:
parent
af107cff65
commit
cd47271cf5
1 changed files with 13 additions and 5 deletions
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue