Report errors properly when git driver fails to write in the cache, refs #482
parent
116b822953
commit
08670e7666
|
@ -38,6 +38,13 @@ class GitDriver extends VcsDriver
|
|||
} else {
|
||||
$this->repoDir = $this->config->get('home') . '/cache.git/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
|
||||
|
||||
$fs = new Filesystem();
|
||||
$fs->ensureDirectoryExists(dirname($this->repoDir));
|
||||
|
||||
if (!is_writable(dirname($this->repoDir))) {
|
||||
throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
|
||||
}
|
||||
|
||||
// update the repo if it is a valid git repository
|
||||
if (is_dir($this->repoDir) && 0 === $this->process->execute('git remote', $output, $this->repoDir)) {
|
||||
if (0 !== $this->process->execute('git remote update --prune origin', $output, $this->repoDir)) {
|
||||
|
@ -45,7 +52,6 @@ class GitDriver extends VcsDriver
|
|||
}
|
||||
} else {
|
||||
// clean up directory and do a fresh clone into it
|
||||
$fs = new Filesystem();
|
||||
$fs->removeDirectory($this->repoDir);
|
||||
|
||||
// added in git 1.7.1, prevents prompting the user
|
||||
|
|
Loading…
Reference in New Issue