소스 검색

Fix detection of versions with git 1.8+, fixes #2065

Jordi Boggiano 11 년 전
부모
커밋
8766c7072b
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/Composer/Package/Loader/RootPackageLoader.php

+ 2 - 2
src/Composer/Package/Loader/RootPackageLoader.php

@@ -194,8 +194,8 @@ class RootPackageLoader extends ArrayLoader
 
             // find current branch and collect all branch names
             foreach ($this->process->splitLines($output) as $branch) {
-                if ($branch && preg_match('{^(?:\* ) *(\S+|\(no branch\)) *([a-f0-9]+) .*$}', $branch, $match)) {
-                    if ($match[1] === '(no branch)') {
+                if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from [a-f0-9]+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
+                    if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ') {
                         $version = 'dev-'.$match[2];
                         $isFeatureBranch = true;
                     } else {