Force exact tag checks when we are in a detached head state

main
Jordi Boggiano 7 years ago
parent 08fc56b38a
commit c0b03d0d34

@ -89,6 +89,7 @@ class VersionGuesser
$commit = null; $commit = null;
$version = null; $version = null;
$prettyVersion = null; $prettyVersion = null;
$isDetached = false;
// try to fetch current version from git branch // try to fetch current version from git branch
if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) { if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
@ -102,6 +103,7 @@ class VersionGuesser
$version = 'dev-' . $match[2]; $version = 'dev-' . $match[2];
$prettyVersion = $version; $prettyVersion = $version;
$isFeatureBranch = true; $isFeatureBranch = true;
$isDetached = true;
} else { } else {
$version = $this->versionParser->normalizeBranch($match[1]); $version = $this->versionParser->normalizeBranch($match[1]);
$prettyVersion = 'dev-' . $match[1]; $prettyVersion = 'dev-' . $match[1];
@ -131,7 +133,7 @@ class VersionGuesser
} }
} }
if (!$version) { if (!$version || $isDetached) {
$result = $this->versionFromGitTags($path); $result = $this->versionFromGitTags($path);
if ($result) { if ($result) {
$version = $result['version']; $version = $result['version'];

Loading…
Cancel
Save