Skip to content

Commit

Permalink
Merge branch '1.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Feb 11, 2021
2 parents 52d7c6c + 812207c commit e7f6dd2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Composer/Repository/Vcs/GitDriver.php
Expand Up @@ -37,6 +37,9 @@ public function initialize()
{
if (Filesystem::isLocalPath($this->url)) {
$this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
if (!is_dir($this->url)) {
throw new \RuntimeException('Failed to read package information from '.$this->url.' as the path does not exist');
}
$this->repoDir = $this->url;
$cacheUrl = realpath($this->url);
} else {
Expand Down
8 changes: 8 additions & 0 deletions src/Composer/Util/ProcessExecutor.php
Expand Up @@ -98,11 +98,15 @@ private function doExecute($command, $cwd, $tty, &$output = null)
$this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
}

// TODO in 2.2, these two checks can be dropped as Symfony 4+ supports them out of the box
// make sure that null translate to the proper directory in case the dir is a symlink
// and we call a git command, because msysgit does not handle symlinks properly
if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
$cwd = realpath(getcwd());
}
if (null !== $cwd && !is_dir($cwd)) {
throw new \RuntimeException('The given CWD for the process does not exist: '.$cwd);
}

$this->captureOutput = func_num_args() > 3;
$this->errorOutput = null;
Expand Down Expand Up @@ -235,11 +239,15 @@ private function startJob($id)
$this->io->writeError('Executing async command ('.($cwd ?: 'CWD').'): '.$safeCommand);
}

// TODO in 2.2, these two checks can be dropped as Symfony 4+ supports them out of the box
// make sure that null translate to the proper directory in case the dir is a symlink
// and we call a git command, because msysgit does not handle symlinks properly
if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
$cwd = realpath(getcwd());
}
if (null !== $cwd && !is_dir($cwd)) {
throw new \RuntimeException('The given CWD for the process does not exist: '.$cwd);
}

// TODO in v3, commands should be passed in as arrays of cmd + args
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
Expand Down

0 comments on commit e7f6dd2

Please sign in to comment.