浏览代码

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

Jordi Boggiano 9 年之前
父节点
当前提交
b31052fcde
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      src/Composer/Command/StatusCommand.php
  2. 2 2
      src/Composer/Downloader/GitDownloader.php

+ 1 - 1
src/Composer/Command/StatusCommand.php

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

+ 2 - 2
src/Composer/Downloader/GitDownloader.php

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