diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index 35f6aa754..beccd55ec 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -73,6 +73,10 @@ class GitDownloader extends VcsDownloader */ public function getLocalChanges($path) { + if (!is_dir($path.'/.git')) { + return; + } + $command = sprintf('cd %s && git status --porcelain --untracked-files=no', escapeshellarg($path)); if (0 !== $this->process->execute($command, $output)) { throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); diff --git a/src/Composer/Downloader/HgDownloader.php b/src/Composer/Downloader/HgDownloader.php index fc66e40eb..a3ee59788 100644 --- a/src/Composer/Downloader/HgDownloader.php +++ b/src/Composer/Downloader/HgDownloader.php @@ -54,6 +54,10 @@ class HgDownloader extends VcsDownloader */ public function getLocalChanges($path) { + if (!is_dir($path.'/.hg')) { + return; + } + $this->process->execute(sprintf('cd %s && hg st', escapeshellarg($path)), $output); return trim($output) ?: null; diff --git a/src/Composer/Downloader/SvnDownloader.php b/src/Composer/Downloader/SvnDownloader.php index c828337f3..82f2bd336 100644 --- a/src/Composer/Downloader/SvnDownloader.php +++ b/src/Composer/Downloader/SvnDownloader.php @@ -50,6 +50,10 @@ class SvnDownloader extends VcsDownloader */ public function getLocalChanges($path) { + if (!is_dir($path.'/.svn')) { + return; + } + $this->process->execute('svn status --ignore-externals', $output, $path); return preg_match('{^ *[^X ] +}m', $output) ? $output : null;