diff --git a/src/workflow/ArcanistLandWorkflow.php b/src/workflow/ArcanistLandWorkflow.php --- a/src/workflow/ArcanistLandWorkflow.php +++ b/src/workflow/ArcanistLandWorkflow.php @@ -310,6 +310,33 @@ return null; } + private function getGitSvnTrunk() { + if (!$this->isGitSvn) { + return null; + } + + // See T13293, this depends on the options passed when cloning. + // On any error we return `trunk`, which was the previous default. + + $repository_api = $this->getRepositoryAPI(); + list($err, $refspec) = $repository_api->execManualLocal( + 'config svn-remote.svn.fetch'); + + if ($err) { + return 'trunk'; + } + + $refspec = rtrim(substr($refspec, strrpos($refspec, ':') + 1)); + + $prefix = 'refs/remotes/'; + if (substr($refspec, 0, strlen($prefix)) !== $prefix) { + return 'trunk'; + } + + $refspec = substr($refspec, strlen($prefix)); + return $refspec; + } + private function readEngineArguments() { // NOTE: This is hard-coded for Git right now. // TODO: Clean this up and move it into LandEngines. @@ -494,7 +521,7 @@ $this->ontoRemoteBranch = $this->onto; if ($this->isGitSvn) { - $this->ontoRemoteBranch = 'trunk'; + $this->ontoRemoteBranch = $this->getGitSvnTrunk(); } else if ($this->isGit) { $this->ontoRemoteBranch = $this->remote.'/'.$this->onto; }