Sfoglia il codice sorgente

better message if git isn't found

Nami-Doc 13 anni fa
parent
commit
2c58dbf3a1
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 6 1
      src/Composer/Repository/Vcs/GitDriver.php

+ 6 - 1
src/Composer/Repository/Vcs/GitDriver.php

@@ -53,7 +53,12 @@ class GitDriver extends VcsDriver
 
                 $command = sprintf('git clone --mirror %s %s', escapeshellarg($this->url), escapeshellarg($this->repoDir));
                 if (0 !== $this->process->execute($command, $output)) {
-                    throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it ('.$this->process->getErrorOutput().')');
+                    $output = $this->process->getErrorOutput();
+                    if (false === strpos($this->process->execute('git --version', $handler), 'git version')) {
+                        throw new \RuntimeException('Failed to clone '.$this->url.', it looks like git isn\'t accessible through the console, please check your installation and your PATH env.' . "\n\n" . $this->process->getErrorOutput());
+                    } else {
+                        throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it ('.$output.')');
+                    }
                 }
             }
         }