1
0
Fork 0

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
pull/1349/merge
Jordi Boggiano 2012-11-20 14:32:57 +01:00
parent c5af2eacf1
commit 18973ed0b9
3 changed files with 12 additions and 0 deletions

View File

@ -73,6 +73,10 @@ class GitDownloader extends VcsDownloader
*/ */
public function getLocalChanges($path) public function getLocalChanges($path)
{ {
if (!is_dir($path.'/.git')) {
return;
}
$command = sprintf('cd %s && git status --porcelain --untracked-files=no', escapeshellarg($path)); $command = sprintf('cd %s && git status --porcelain --untracked-files=no', escapeshellarg($path));
if (0 !== $this->process->execute($command, $output)) { if (0 !== $this->process->execute($command, $output)) {
throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());

View File

@ -54,6 +54,10 @@ class HgDownloader extends VcsDownloader
*/ */
public function getLocalChanges($path) public function getLocalChanges($path)
{ {
if (!is_dir($path.'/.hg')) {
return;
}
$this->process->execute(sprintf('cd %s && hg st', escapeshellarg($path)), $output); $this->process->execute(sprintf('cd %s && hg st', escapeshellarg($path)), $output);
return trim($output) ?: null; return trim($output) ?: null;

View File

@ -50,6 +50,10 @@ class SvnDownloader extends VcsDownloader
*/ */
public function getLocalChanges($path) public function getLocalChanges($path)
{ {
if (!is_dir($path.'/.svn')) {
return;
}
$this->process->execute('svn status --ignore-externals', $output, $path); $this->process->execute('svn status --ignore-externals', $output, $path);
return preg_match('{^ *[^X ] +}m', $output) ? $output : null; return preg_match('{^ *[^X ] +}m', $output) ? $output : null;