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