function GitDownloader::discardChanges
@phpstan-return PromiseInterface<void|null>
Throws
\RuntimeException
1 call to GitDownloader::discardChanges()
- GitDownloader::cleanChanges in vendor/
composer/ composer/ src/ Composer/ Downloader/ GitDownloader.php - @inheritDoc
File
-
vendor/
composer/ composer/ src/ Composer/ Downloader/ GitDownloader.php, line 551
Class
- GitDownloader
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\DownloaderCode
protected function discardChanges(string $path) : PromiseInterface {
$path = $this->normalizePath($path);
if (0 !== $this->process
->execute([
'git',
'clean',
'-df',
], $output, $path)) {
throw new \RuntimeException("Could not reset changes\n\n:" . $output);
}
if (0 !== $this->process
->execute([
'git',
'reset',
'--hard',
], $output, $path)) {
throw new \RuntimeException("Could not reset changes\n\n:" . $output);
}
$this->hasDiscardedChanges[$path] = true;
return \React\Promise\resolve(null);
}