Ver código fonte

Detect version based on tag if HEAD points to a tag.

Beau Simensen 12 anos atrás
pai
commit
c0a20c3d30
1 arquivos alterados com 5 adições e 0 exclusões
  1. 5 0
      src/Composer/Package/Loader/RootPackageLoader.php

+ 5 - 0
src/Composer/Package/Loader/RootPackageLoader.php

@@ -184,6 +184,11 @@ class RootPackageLoader extends ArrayLoader
 
     private function guessGitVersion(array $config)
     {
+        // try to fetch current version from git branch as a tag
+        if (0 === $this->process->execute('git describe --exact-match', $output)) {
+            return $this->versionParser->normalize(rtrim($output));
+        }
+
         // try to fetch current version from git branch
         if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output)) {
             $branches = array();