Browse Source

check first if there are changes

Ricard Clau 12 years ago
parent
commit
56f4625ec8

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

@@ -90,6 +90,10 @@ class GitDownloader extends VcsDownloader
      */
     protected function cleanChanges($path, $update)
     {
+        if (!$changes = $this->getLocalChanges($path)) {
+            return;
+        }
+
         $discardChanges = $this->config->get('discard-changes');
         if (!$this->io->isInteractive()) {
             switch ($discardChanges) {
@@ -109,10 +113,6 @@ class GitDownloader extends VcsDownloader
             }
         }
 
-        if (!$changes = $this->getLocalChanges($path)) {
-            return;
-        }
-
         $changes = array_map(function ($elem) {
             return '    '.$elem;
         }, preg_split('{\s*\r?\n\s*}', $changes));

+ 4 - 4
src/Composer/Downloader/SvnDownloader.php

@@ -88,6 +88,10 @@ class SvnDownloader extends VcsDownloader
      */
     protected function cleanChanges($path, $update)
     {
+        if (!$changes = $this->getLocalChanges($path)) {
+            return;
+        }
+
         $discardChanges = $this->config->get('discard-changes');
         if (!$this->io->isInteractive()) {
             switch ($discardChanges) {
@@ -101,10 +105,6 @@ class SvnDownloader extends VcsDownloader
             }
         }
 
-        if (!$changes = $this->getLocalChanges($path)) {
-            return;
-        }
-
         $changes = array_map(function ($elem) {
             return '    '.$elem;
         }, preg_split('{\s*\r?\n\s*}', $changes));