Skip to content

Commit

Permalink
composer#11855 fix: potentially fix bareRepository error
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-ciszewski committed May 7, 2024
1 parent 2fe3244 commit eb60b0f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Composer/Util/ProcessExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,16 @@ private function doExecute($command, ?string $cwd, bool $tty, &$output = null):
$this->captureOutput = func_num_args() > 3;
$this->errorOutput = '';

$env = null;

if ($cwd && is_int(stripos($cwd, 'git '))) {
$env = ['GIT_DIR' => $cwd . '/.git'];
}

if (is_string($command)) {
$process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
$process = Process::fromShellCommandline($command, $cwd, $env, null, static::getTimeout());
} else {
$process = new Process($command, $cwd, null, null, static::getTimeout());
$process = new Process($command, $cwd, $env, null, static::getTimeout());
}

if (!Platform::isWindows() && $tty) {
Expand Down

0 comments on commit eb60b0f

Please sign in to comment.