Page MenuHomePhabricator

D14420.id34836.diff
No OneTemporary

D14420.id34836.diff

diff --git a/src/land/ArcanistGitLandEngine.php b/src/land/ArcanistGitLandEngine.php
--- a/src/land/ArcanistGitLandEngine.php
+++ b/src/land/ArcanistGitLandEngine.php
@@ -262,13 +262,26 @@
$path->removeUpstream($local_branch);
if (!$path->getLength()) {
- $this->writeInfo(
- pht('UPDATE'),
- pht(
- 'Local branch "%s" directly tracks remote, staying on '.
- 'detached HEAD.',
- $local_branch));
- return;
+ // The local branch tracked upstream directly; however, it
+ // may not be the only one to do so. If there's a local
+ // branch of the same name that tracks the remote, try
+ // switching to that.
+ $local_branch = $this->getTargetOnto();
+ list($err) = $api->execManualLocal(
+ 'rev-parse --verify %s',
+ $local_branch);
+ if (!$err) {
+ $path = $api->getPathToUpstream($local_branch);
+ }
+ if (!$path->isConnectedToRemote()) {
+ $this->writeInfo(
+ pht('UPDATE'),
+ pht(
+ 'Local branch "%s" directly tracks remote, staying on '.
+ 'detached HEAD.',
+ $local_branch));
+ return;
+ }
}
$local_branch = head($path->getLocalBranches());

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 18, 7:41 PM (3 d, 1 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7710302
Default Alt Text
D14420.id34836.diff (1 KB)

Event Timeline