From 4205eeae099fc18ffb90ec489ea75c7e157227ed Mon Sep 17 00:00:00 2001 From: Buster Neece Date: Fri, 3 Feb 2023 15:01:50 -0600 Subject: [PATCH] Bug fixes. --- src/Version.php | 10 +--------- util/write_git_info.sh | 6 +----- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Version.php b/src/Version.php index 1988e9846..ca703eb3b 100644 --- a/src/Version.php +++ b/src/Version.php @@ -80,9 +80,7 @@ final class Version $details['commit_date'] = 'N/A'; } - if (empty($details['tag'])) { - $details['tag'] = self::FALLBACK_VERSION; - } + $details['tag'] = self::FALLBACK_VERSION; $ttl = $this->environment->isProduction() ? 86400 : 600; @@ -108,7 +106,6 @@ final class Version return [ 'commit' => $gitInfo['COMMIT_LONG'] ?? null, 'commit_date_raw' => $gitInfo['COMMIT_DATE'] ?? null, - 'tag' => $gitInfo['TAG'] ?? null, 'branch' => $gitInfo['BRANCH'] ?? null, ]; } catch (\Throwable) { @@ -118,14 +115,9 @@ final class Version } if (is_dir($this->repoDir . '/.git')) { - $last_tagged_commit = $this->runProcess(['git', 'rev-list', '--tags', '--max-count=1']); - return [ 'commit' => $this->runProcess(['git', 'log', '--pretty=%H', '-n1', 'HEAD']), 'commit_date_raw' => $this->runProcess(['git', 'log', '-n1', '--pretty=%ci', 'HEAD']), - 'tag' => (!empty($last_tagged_commit)) - ? $this->runProcess(['git', 'describe', '--tags', $last_tagged_commit], 'N/A') - : null, 'branch' => $this->runProcess(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], 'main'), ]; } diff --git a/util/write_git_info.sh b/util/write_git_info.sh index eace98c4e..f6ed8ffb0 100644 --- a/util/write_git_info.sh +++ b/util/write_git_info.sh @@ -8,12 +8,8 @@ cd .. COMMIT_LONG=$(git log --pretty=%H -n1 HEAD) COMMIT_DATE=$(git log -n1 --pretty=%ci HEAD) -LAST_TAG_HASH=$(git rev-list --tags --max-count=1) -LAST_TAG=$(git describe --tags $LAST_TAG_HASH) - -BRANCH=$(git rev-parse --abbrev-ref HEAD main | head -n 1) +BRANCH=$(git rev-parse --abbrev-ref HEAD | head -n 1) printf "COMMIT_LONG=\"%s\"\n" "$COMMIT_LONG" > .gitinfo printf "COMMIT_DATE=\"%s\"\n" "$COMMIT_DATE" >> .gitinfo -printf "LAST_TAG=\"%s\"\n" "$LAST_TAG" >> .gitinfo printf "BRANCH=\"%s\"\n" "$BRANCH" >> .gitinfo