feat: 버전 표기에 branch명 같이 표기
This commit is contained in:
@@ -6,12 +6,26 @@ class VersionGitDynamic
|
|||||||
{
|
{
|
||||||
static function getVersion()
|
static function getVersion()
|
||||||
{
|
{
|
||||||
|
$versionTokens = [];
|
||||||
|
|
||||||
$command = 'git describe --long --tags';
|
$command = 'git describe --long --tags';
|
||||||
exec($command, $output);
|
exec($command, $output);
|
||||||
if (is_array($output)) {
|
if (is_array($output)) {
|
||||||
$output = join('', $output);
|
$versionTokens[] = trim(join('', $output));
|
||||||
}
|
}
|
||||||
return trim($output);
|
|
||||||
|
$command = 'git branch --contains HEAD';
|
||||||
|
exec($command, $output);
|
||||||
|
if (is_array($output)) {
|
||||||
|
if (count($output)) {
|
||||||
|
$output = $output[1];
|
||||||
|
$versionTokens[] = trim($output, " \t\n\r\0\x0b*");
|
||||||
|
} else {
|
||||||
|
$versionTokens[] = 'unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return join('-', $versionTokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getHash()
|
static function getHash()
|
||||||
|
|||||||
+21
-2
@@ -7,6 +7,8 @@ set_time_limit(600);
|
|||||||
|
|
||||||
function getVersion($target = null)
|
function getVersion($target = null)
|
||||||
{
|
{
|
||||||
|
$versionTokens = [];
|
||||||
|
|
||||||
if ($target) {
|
if ($target) {
|
||||||
$command = sprintf('git describe %s --long --tags', escapeshellarg($target));
|
$command = sprintf('git describe %s --long --tags', escapeshellarg($target));
|
||||||
} else {
|
} else {
|
||||||
@@ -14,9 +16,26 @@ function getVersion($target = null)
|
|||||||
}
|
}
|
||||||
exec($command, $output);
|
exec($command, $output);
|
||||||
if (is_array($output)) {
|
if (is_array($output)) {
|
||||||
$output = join('', $output);
|
$versionTokens[] = trim(join('', $output));
|
||||||
}
|
}
|
||||||
return trim($output);
|
|
||||||
|
if ($target) {
|
||||||
|
$command = sprintf('git branch --contains %s', escapeshellarg($target));
|
||||||
|
} else {
|
||||||
|
$command = 'git branch --contains HEAD';
|
||||||
|
}
|
||||||
|
exec($command, $output);
|
||||||
|
if (is_array($output)) {
|
||||||
|
if(count($output)){
|
||||||
|
$output = $output[1];
|
||||||
|
$versionTokens[] = trim($output, " \t\n\r\0\x0b*");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$versionTokens[] = 'unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return join('-', $versionTokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHash($target = 'HEAD')
|
function getHash($target = 'HEAD')
|
||||||
|
|||||||
Reference in New Issue
Block a user