Bläddra i källkod

Do not check for changes if there is no vcs dir

In case the package is in a broken state we do not want to show diffs from the main project
Jordi Boggiano 12 år sedan
förälder
incheckning
18973ed0b9

+ 4 - 0
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());

+ 4 - 0
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;

+ 4 - 0
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;