mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-08 22:01:02 +01:00
Fix arc land on odd/modern git-svn checkouts
Summary: The current code assumes git-svn is always working from a remote called `trunk`, but if the repository is initialized without the `-T` option it will instead be called `git-svn`, and if `--prefix` is used (which is set by default to `origin/` in Git 2+) the remote name will have the specified prefix as well. Instead, look at the `fetch` target refspec set in the git-svn config. Fixes T13293. Test Plan: `arc land` without errors (or manually creating a `trunk` branch) from a checkout made with Git 2.18.0 (verified this manually on a non-`-T` checkout as well). Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin Maniphest Tasks: T13293 Differential Revision: https://secure.phabricator.com/D19681
This commit is contained in:
parent
dd514e268b
commit
7329bc7c32
1 changed files with 28 additions and 1 deletions
|
@ -310,6 +310,33 @@ EOTEXT
|
|||
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 @@ EOTEXT
|
|||
|
||||
$this->ontoRemoteBranch = $this->onto;
|
||||
if ($this->isGitSvn) {
|
||||
$this->ontoRemoteBranch = 'trunk';
|
||||
$this->ontoRemoteBranch = $this->getGitSvnTrunk();
|
||||
} else if ($this->isGit) {
|
||||
$this->ontoRemoteBranch = $this->remote.'/'.$this->onto;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue