From cb5cfb28cdbabb7bf2fbe9226f721a6c1ea08500 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 7 Aug 2012 18:21:32 -0700 Subject: [PATCH] Fix an issue where branches at the same commit race to destruction in "arc branch" Summary: If two branches have the same HEAD, they currently race to overwrite each other in $commit_map. We don't need to return a map indexed by commit since nothing ever reads the keys out of it. Just update $branches in place. Test Plan: With two branches at the same HEAD, ran "arc branch". Saw both branches in output. Reviewers: vrana, btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D3188 --- src/workflow/ArcanistBranchWorkflow.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/workflow/ArcanistBranchWorkflow.php b/src/workflow/ArcanistBranchWorkflow.php index 0bab773f..cba17fbc 100644 --- a/src/workflow/ArcanistBranchWorkflow.php +++ b/src/workflow/ArcanistBranchWorkflow.php @@ -109,7 +109,6 @@ EOTEXT $branches = ipull($branches, null, 'name'); - $commit_map = array(); foreach (Futures($futures) as $name => $future) { list($info) = $future->resolvex(); list($hash, $epoch, $tree, $desc, $text) = explode("\1", trim($info), 5); @@ -133,10 +132,10 @@ EOTEXT // do nothing. } - $commit_map[$hash] = $branch; + $branches[$name] = $branch; } - return $commit_map; + return $branches; } private function loadRevisions(array $branches) { -- 2.43.0