1
0
Fork 0

Fix authorization/authentication merge, fixes #1684

pull/1681/merge
Jordi Boggiano 2013-03-11 10:04:45 +01:00
parent ee60df708d
commit d81740ab7d
1 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ class GitDownloader extends VcsDownloader
// capture username/password from URL if there is one // capture username/password from URL if there is one
$this->process->execute(sprintf('cd %s && git remote -v', escapeshellarg($path)), $output); $this->process->execute(sprintf('cd %s && git remote -v', escapeshellarg($path)), $output);
if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) { if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
$this->io->setAuthorization($match[3], urldecode($match[1]), urldecode($match[2])); $this->io->setAuthentication($match[3], urldecode($match[1]), urldecode($match[2]));
} }
// added in git 1.7.1, prevents prompting the user // added in git 1.7.1, prevents prompting the user
@ -324,8 +324,8 @@ class GitDownloader extends VcsDownloader
preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match) && preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match) &&
strpos($this->process->getErrorOutput(), 'fatal: Authentication failed') !== false strpos($this->process->getErrorOutput(), 'fatal: Authentication failed') !== false
) { ) {
if ($this->io->hasAuthorization($match[2])) { if ($this->io->hasAuthentication($match[2])) {
$auth = $this->io->getAuthorization($match[2]); $auth = $this->io->getAuthentication($match[2]);
} else { } else {
$this->io->write($url.' requires Authentication'); $this->io->write($url.' requires Authentication');
$auth = array( $auth = array(
@ -338,7 +338,7 @@ class GitDownloader extends VcsDownloader
$command = call_user_func($commandCallable, $url); $command = call_user_func($commandCallable, $url);
if (0 === $this->process->execute($command, $handler)) { if (0 === $this->process->execute($command, $handler)) {
$this->io->setAuthorization($match[2], $auth['username'], $auth['password']); $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
return; return;
} }