mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-02 09:58:24 +01:00
Fix a fatal in the document engine blame view with files that blame to the initial commit
Summary: Ref T13126. When you view a file using the new document engine view and some lines were introduced in the initial commit to the repository, Git renders "^abc123" in the blame output. We currently don't do anything about this, and later fail to look it up and fatal. It's also unlikely-but-conceivably-possible to end up here if a commit has not imported yet or has been nuked with `bin/remove destroy`. Let the whole thing run without fataling even if a `$commit` is missing. Future refinements could improve this behavior. Test Plan: Viewed a file with lines introduced in the initial commit, got empty blame instead of a fatal. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13126 Differential Revision: https://secure.phabricator.com/D19391
This commit is contained in:
parent
9bf4df2c1d
commit
95e179d9a4
1 changed files with 35 additions and 15 deletions
|
@ -80,7 +80,6 @@ final class DiffusionBlameController extends DiffusionController {
|
||||||
|
|
||||||
$handles = $viewer->loadHandles($handle_phids);
|
$handles = $viewer->loadHandles($handle_phids);
|
||||||
|
|
||||||
|
|
||||||
$map = array();
|
$map = array();
|
||||||
$epochs = array();
|
$epochs = array();
|
||||||
foreach ($identifiers as $identifier) {
|
foreach ($identifiers as $identifier) {
|
||||||
|
@ -106,9 +105,21 @@ final class DiffusionBlameController extends DiffusionController {
|
||||||
),
|
),
|
||||||
$skip_icon);
|
$skip_icon);
|
||||||
|
|
||||||
$commit = $commits[$identifier];
|
// We may not have a commit object for a given identifier if the commit
|
||||||
|
// has not imported yet.
|
||||||
|
|
||||||
|
// At time of writing, this can also happen if a line was part of the
|
||||||
|
// initial import: blame produces a "^abc123" identifier in Git, which
|
||||||
|
// doesn't correspond to a real commit.
|
||||||
|
|
||||||
|
$commit = idx($commits, $identifier);
|
||||||
|
|
||||||
|
$author_phid = null;
|
||||||
|
|
||||||
|
if ($commit) {
|
||||||
|
$author_phid = $commit->getAuthorPHID();
|
||||||
|
}
|
||||||
|
|
||||||
$author_phid = $commit->getAuthorPHID();
|
|
||||||
if (!$author_phid && $revision) {
|
if (!$author_phid && $revision) {
|
||||||
$author_phid = $revision->getAuthorPHID();
|
$author_phid = $revision->getAuthorPHID();
|
||||||
}
|
}
|
||||||
|
@ -141,18 +152,22 @@ final class DiffusionBlameController extends DiffusionController {
|
||||||
'meta' => $author_meta,
|
'meta' => $author_meta,
|
||||||
));
|
));
|
||||||
|
|
||||||
$commit_link = javelin_tag(
|
if ($commit) {
|
||||||
'a',
|
$commit_link = javelin_tag(
|
||||||
array(
|
'a',
|
||||||
'href' => $commit->getURI(),
|
array(
|
||||||
'sigil' => 'has-tooltip',
|
'href' => $commit->getURI(),
|
||||||
'meta' => array(
|
'sigil' => 'has-tooltip',
|
||||||
'tip' => $this->renderCommitTooltip($commit, $handles),
|
'meta' => array(
|
||||||
'align' => 'E',
|
'tip' => $this->renderCommitTooltip($commit, $handles),
|
||||||
'size' => 600,
|
'align' => 'E',
|
||||||
|
'size' => 600,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
$commit->getLocalName());
|
||||||
$commit->getLocalName());
|
} else {
|
||||||
|
$commit_link = null;
|
||||||
|
}
|
||||||
|
|
||||||
$info = array(
|
$info = array(
|
||||||
$author_link,
|
$author_link,
|
||||||
|
@ -180,7 +195,12 @@ final class DiffusionBlameController extends DiffusionController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$epoch = $commit->getEpoch();
|
if ($commit) {
|
||||||
|
$epoch = $commit->getEpoch();
|
||||||
|
} else {
|
||||||
|
$epoch = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$epochs[] = $epoch;
|
$epochs[] = $epoch;
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
|
|
Loading…
Add table
Reference in a new issue