Преглед изворни кода

Only update the git repo if the commit we want doesn't exist, speeds up update from source

Richard Heelin пре 8 година
родитељ
комит
5dfd23668e
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3 3
      src/Composer/Downloader/GitDownloader.php

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

@@ -105,10 +105,10 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
 
         $ref = $target->getSourceReference();
         $this->io->writeError("    Checking out ".$ref);
-        $command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer';
+        $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s^{commit} || (git fetch composer && git fetch --tags composer)';
 
-        $commandCallable = function ($url) use ($command) {
-            return sprintf($command, ProcessExecutor::escape($url));
+        $commandCallable = function ($url) use ($command, $ref) {
+            return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
         };
 
         $this->gitUtil->runCommand($commandCallable, $url, $path);