Browse Source

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

Beau Simensen 12 năm trước cách đây
mục cha
commit
c0a20c3d30
1 tập tin đã thay đổi với 5 bổ sung0 xóa
  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();