fix: branch 못 알아낸 건 unknown으로 하기
This commit is contained in:
@@ -17,8 +17,8 @@ class VersionGitDynamic
|
|||||||
$command = 'git branch --contains HEAD';
|
$command = 'git branch --contains HEAD';
|
||||||
exec($command, $output);
|
exec($command, $output);
|
||||||
if (is_array($output)) {
|
if (is_array($output)) {
|
||||||
if (count($output)) {
|
if (count($output) > 1) {
|
||||||
$output = Util::array_last($output);
|
$output = $output[1];
|
||||||
$output = trim($output, " \t\n\r\0\x0b*");
|
$output = trim($output, " \t\n\r\0\x0b*");
|
||||||
$output = explode('/', $output);
|
$output = explode('/', $output);
|
||||||
$versionTokens[] = Util::array_last($output);
|
$versionTokens[] = Util::array_last($output);
|
||||||
|
|||||||
+7
-4
@@ -9,6 +9,9 @@ set_time_limit(600);
|
|||||||
function getVersion($target = null)
|
function getVersion($target = null)
|
||||||
{
|
{
|
||||||
$versionTokens = [];
|
$versionTokens = [];
|
||||||
|
if ($target) {
|
||||||
|
$target = trim($target);
|
||||||
|
}
|
||||||
|
|
||||||
if ($target) {
|
if ($target) {
|
||||||
$command = sprintf('git describe %s --long --tags', escapeshellarg($target));
|
$command = sprintf('git describe %s --long --tags', escapeshellarg($target));
|
||||||
@@ -21,14 +24,14 @@ function getVersion($target = null)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($target) {
|
if ($target) {
|
||||||
$command = sprintf('git branch --contains %s', escapeshellarg($target));
|
$command = sprintf('git branch -a --contains %s', escapeshellarg($target));
|
||||||
} else {
|
} else {
|
||||||
$command = 'git branch --contains HEAD';
|
$command = 'git branch -a --contains HEAD';
|
||||||
}
|
}
|
||||||
exec($command, $output);
|
exec($command, $output);
|
||||||
if (is_array($output)) {
|
if (is_array($output)) {
|
||||||
if (count($output)) {
|
if (count($output) > 1) {
|
||||||
$output = Util::array_last($output);
|
$output = $output[1];
|
||||||
$output = trim($output, " \t\n\r\0\x0b*");
|
$output = trim($output, " \t\n\r\0\x0b*");
|
||||||
$output = explode('/', $output);
|
$output = explode('/', $output);
|
||||||
$versionTokens[] = Util::array_last($output);
|
$versionTokens[] = Util::array_last($output);
|
||||||
|
|||||||
Reference in New Issue
Block a user