From 8ea9935ea5c2b9d7066ea8f96031fb3fd7d4ed8c Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 2 Jun 2014 15:25:28 -0700 Subject: [PATCH] Deduplicate parents from PhabricatorGitGraphStream Summary: Fixes T5226. It's rare (but possible) for a commit to have the same parent more than once in Git. Test Plan: Ran `bin/repository parents` on a normal repository. Reviewers: joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Maniphest Tasks: T5226 Differential Revision: https://secure.phabricator.com/D9344 --- .../repository/daemon/PhabricatorGitGraphStream.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/applications/repository/daemon/PhabricatorGitGraphStream.php b/src/applications/repository/daemon/PhabricatorGitGraphStream.php index 5cbac88a7e..9133983677 100644 --- a/src/applications/repository/daemon/PhabricatorGitGraphStream.php +++ b/src/applications/repository/daemon/PhabricatorGitGraphStream.php @@ -29,7 +29,12 @@ final class PhabricatorGitGraphStream if (!isset($this->parents[$commit])) { $this->parseUntil($commit); } - return $this->parents[$commit]; + $parents = $this->parents[$commit]; + + // NOTE: In Git, it is possible for a commit to list the same parent more + // than once. See T5226. Discard duplicate parents. + + return array_unique($parents); } public function getCommitDate($commit) {