diff --git a/src/workflow/ArcanistPatchWorkflow.php b/src/workflow/ArcanistPatchWorkflow.php --- a/src/workflow/ArcanistPatchWorkflow.php +++ b/src/workflow/ArcanistPatchWorkflow.php @@ -217,9 +217,9 @@ $base_name .= "-D{$revision_id}"; } - $suffixes = array(null, '_1', '_2', '_3'); - foreach ($suffixes as $suffix) { - $proposed_name = $base_name.$suffix; + $proposed_suffix = null; + while (!$branch_name) { + $proposed_name = "{$base_name}_{$proposed_suffix}"; list($err) = $repository_api->execManualLocal( 'rev-parse --verify %s', @@ -232,6 +232,7 @@ pht( 'Branch name %s already exists; trying a new name.', $proposed_name)); + $proposed_suffix = $proposed_suffix + 1; continue; } else { $branch_name = $proposed_name;