function GitDriver::getFileContent
@inheritDoc
Overrides VcsDriverInterface::getFileContent
File
-
vendor/
composer/ composer/ src/ Composer/ Repository/ Vcs/ GitDriver.php, line 147
Class
- GitDriver
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\Repository\VcsCode
public function getFileContent(string $file, string $identifier) : ?string {
if (isset($identifier[0]) && $identifier[0] === '-') {
throw new \RuntimeException('Invalid git identifier detected. Identifier must not start with a -, given: ' . $identifier);
}
$this->process
->execute([
'git',
'show',
$identifier . ':' . $file,
], $content, $this->repoDir);
if (trim($content) === '') {
return null;
}
return $content;
}