1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Refine "arc land" behavior when pushing "onto" a new branch

Summary:
Ref T13546. If the "onto" branch doesn't exist yet and has a "/" in it, we need to preface it with "refs/heads" explicitly.

Fix a "false/null" issue with argument validation.

Possibly, "arc land" should prompt you before creating branches in the remote.

Test Plan: Ran "arc land --onto does-not-exist/1.1" and created a branch.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21341
This commit is contained in:
epriestley 2020-06-08 16:52:59 -07:00
parent ab70626c12
commit 091aebe014
2 changed files with 7 additions and 2 deletions

View file

@ -885,6 +885,11 @@ final class ArcanistGitLandEngine
$onto_ref)); $onto_ref));
} }
} }
// TODO: Check that these refs really exist in the remote? Checking the
// remote is expensive and users probably rarely specify "--onto" manually,
// but if "arc land" creates branches without prompting when you make typos
// that also seems questionable.
} }
protected function selectOntoRefs(array $symbols) { protected function selectOntoRefs(array $symbols) {
@ -1491,7 +1496,7 @@ final class ArcanistGitLandEngine
foreach ($this->getOntoRefs() as $onto_ref) { foreach ($this->getOntoRefs() as $onto_ref) {
$refspecs[] = sprintf( $refspecs[] = sprintf(
'%s:%s', '%s:refs/heads/%s',
$this->getDisplayHash($into_commit), $this->getDisplayHash($into_commit),
$onto_ref); $onto_ref);
} }

View file

@ -1361,7 +1361,7 @@ abstract class ArcanistLandEngine
} }
$into = $this->getIntoArgument(); $into = $this->getIntoArgument();
if ($into && ($into_empty !== null)) { if ($into && $into_empty) {
throw new PhutilArgumentUsageException( throw new PhutilArgumentUsageException(
pht( pht(
'Arguments "--into" and "--into-empty" are mutually exclusive.')); 'Arguments "--into" and "--into-empty" are mutually exclusive.'));