From 6b035f64d2e2665f407e72a2a8f6528f43119cda Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 26 Nov 2021 19:11:50 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20branch=20=EB=AA=BB=20=EC=95=8C=EC=95=84?= =?UTF-8?q?=EB=82=B8=20=EA=B1=B4=20unknown=EC=9C=BC=EB=A1=9C=20=ED=95=98?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/VersionGitDynamic.php | 4 ++-- j_updateServer.php | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hwe/sammo/VersionGitDynamic.php b/hwe/sammo/VersionGitDynamic.php index bd8642a4..ec19dd29 100644 --- a/hwe/sammo/VersionGitDynamic.php +++ b/hwe/sammo/VersionGitDynamic.php @@ -17,8 +17,8 @@ class VersionGitDynamic $command = 'git branch --contains HEAD'; exec($command, $output); if (is_array($output)) { - if (count($output)) { - $output = Util::array_last($output); + if (count($output) > 1) { + $output = $output[1]; $output = trim($output, " \t\n\r\0\x0b*"); $output = explode('/', $output); $versionTokens[] = Util::array_last($output); diff --git a/j_updateServer.php b/j_updateServer.php index 3fd1585a..50ed0f47 100644 --- a/j_updateServer.php +++ b/j_updateServer.php @@ -9,6 +9,9 @@ set_time_limit(600); function getVersion($target = null) { $versionTokens = []; + if ($target) { + $target = trim($target); + } if ($target) { $command = sprintf('git describe %s --long --tags', escapeshellarg($target)); @@ -21,14 +24,14 @@ function getVersion($target = null) } if ($target) { - $command = sprintf('git branch --contains %s', escapeshellarg($target)); + $command = sprintf('git branch -a --contains %s', escapeshellarg($target)); } else { - $command = 'git branch --contains HEAD'; + $command = 'git branch -a --contains HEAD'; } exec($command, $output); if (is_array($output)) { - if (count($output)) { - $output = Util::array_last($output); + if (count($output) > 1) { + $output = $output[1]; $output = trim($output, " \t\n\r\0\x0b*"); $output = explode('/', $output); $versionTokens[] = Util::array_last($output);