composer status now includes untracked files in git repos, fixes #2664

main
Jordi Boggiano 8 years ago
parent 4f6693ad70
commit b31052fcde

@ -75,7 +75,7 @@ EOT
$errors[$targetDir] = $targetDir . ' is a symbolic link.'; $errors[$targetDir] = $targetDir . ' is a symbolic link.';
} }
if ($changes = $downloader->getLocalChanges($package, $targetDir)) { if ($changes = $downloader->getLocalChanges($package, $targetDir, true)) {
$errors[$targetDir] = $changes; $errors[$targetDir] = $changes;
} }

@ -97,14 +97,14 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getLocalChanges(PackageInterface $package, $path) public function getLocalChanges(PackageInterface $package, $path, $showUntracked = false)
{ {
GitUtil::cleanEnv(); GitUtil::cleanEnv();
if (!$this->hasMetadataRepository($path)) { if (!$this->hasMetadataRepository($path)) {
return; return;
} }
$command = 'git status --porcelain --untracked-files=no'; $command = 'git status --porcelain ' . ($showUntracked ? '' : ' --untracked-files=no');
if (0 !== $this->process->execute($command, $output, $path)) { if (0 !== $this->process->execute($command, $output, $path)) {
throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
} }

Loading…
Cancel
Save