1
0
Fork 0

Fix unitialized git repo, fixes #758

pull/764/merge
Jordi Boggiano 2012-06-04 00:53:51 +02:00
parent cab70cc031
commit 1aa2cfe6e1
1 changed files with 6 additions and 3 deletions

View File

@ -49,6 +49,10 @@ class RootPackageLoader extends ArrayLoader
$version = $this->guessVersion($config);
}
if (!$version) {
$version = '1.0.0';
}
$config['version'] = $version;
} else {
$version = $config['version'];
@ -159,8 +163,9 @@ class RootPackageLoader extends ArrayLoader
// try to fetch current version from git branch
if (function_exists('proc_open') && 0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output)) {
$branches = array();
$isFeatureBranch = true;
$isFeatureBranch = false;
$version = null;
foreach ($this->process->splitLines($output) as $branch) {
if ($branch && preg_match('{^(?:\* ) *(?:[^/ ]+?/)?(\S+|\(no branch\)) *([a-f0-9]+) .*$}', $branch, $match)) {
if ($match[1] === '(no branch)') {
@ -213,7 +218,5 @@ class RootPackageLoader extends ArrayLoader
return $version;
}
return '1.0.0';
}
}