From e48c36697ad4f234635d03534cbad9dc5bad559e Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 4 Jan 2019 14:10:47 -0800 Subject: [PATCH] Make blame UI recover gracefully if Identities haven't been built yet for a commit Summary: See PHI1014. We may not have Identities if you race the import pipeline, or in some other cases which are more "bug" / "missing migration"-flavored. Load the commit data so we can fall back to it if we don't have identities. Test Plan: - Wiped out all my identities with `UPDATE ... SET authorIdentityPHID = NULL WHERE ...`. - Before change: blame fataled with `Attempting to access attached data on PhabricatorRepositoryCommit (via getCommitData()), but the data is not actually attached.`. - After change: blame falls back gracefully. - Restored identities with `bin/repository rebuild-identities`, checked blame again. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D19958 --- .../diffusion/controller/DiffusionBlameController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/applications/diffusion/controller/DiffusionBlameController.php b/src/applications/diffusion/controller/DiffusionBlameController.php index 95cc039217..591462590f 100644 --- a/src/applications/diffusion/controller/DiffusionBlameController.php +++ b/src/applications/diffusion/controller/DiffusionBlameController.php @@ -25,6 +25,9 @@ final class DiffusionBlameController extends DiffusionController { ->withRepository($repository) ->withIdentifiers($identifiers) ->needIdentities(true) + // See PHI1014. If identities haven't been built yet, we may need to + // fall back to raw commit data. + ->needCommitData(true) ->execute(); $commits = mpull($commits, null, 'getCommitIdentifier'); } else {