Browse Source

Only generate lock file when actually necessary, fixes #1064

Jordi Boggiano 12 years ago
parent
commit
10d1a4382f
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/Composer/Package/Locker.php

+ 8 - 0
src/Composer/Package/Locker.php

@@ -198,6 +198,14 @@ class Locker
             $lock['packages-dev'] = $this->lockPackages($devPackages);
         }
 
+        if (empty($lock['packages']) && empty($lock['packages-dev'])) {
+            if ($this->lockFile->exists()) {
+                unlink($this->lockFile->getPath());
+            }
+
+            return false;
+        }
+
         if (!$this->isLocked() || $lock !== $this->getLockData()) {
             $this->lockFile->write($lock);
             $this->lockDataCache = null;