From 4fc7d24900bdf459305d849899bdd4566da6ee82 Mon Sep 17 00:00:00 2001 From: Austin Passy <367897+thefrosty@users.noreply.github.com> Date: Fri, 5 Aug 2022 14:05:32 -0700 Subject: [PATCH] Change functions for default branch from remote, and fix flags. --- bin/functions.sh | 14 +++++++------- tests/unit/Plugin/PluginTest.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/functions.sh b/bin/functions.sh index fe0df15..5ae7dae 100644 --- a/bin/functions.sh +++ b/bin/functions.sh @@ -4,7 +4,7 @@ set -e # Default values of arguments # https://stackoverflow.com/a/44750379/558561 -- get the default git branch name -DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') +DEFAULT_BRANCH=$(git remote show $(git remote) | sed -n '/HEAD branch/s/.*: //p') TEST_VERSION="7.4" OTHER_ARGUMENTS=() @@ -12,13 +12,13 @@ OTHER_ARGUMENTS=() # @ref https://pretzelhands.com/posts/command-line-flags/ for arg in "$@"; do case $arg in - --default-branch) - DEFAULT_BRANCH="$2" - shift 2 # Remove name and value + --default-branch=*) + DEFAULT_BRANCH="${arg#*=}" + shift # Remove --default-branch= from processing ;; - --test-version) - TEST_VERSION="$2" - shift 2 # Remove name and value + --test-version=*) + TEST_VERSION="${arg#*=}" + shift # Remove --test-version= from processing ;; *) OTHER_ARGUMENTS+=("$1") diff --git a/tests/unit/Plugin/PluginTest.php b/tests/unit/Plugin/PluginTest.php index 311b0ec..35945e1 100644 --- a/tests/unit/Plugin/PluginTest.php +++ b/tests/unit/Plugin/PluginTest.php @@ -53,6 +53,6 @@ public function testPlugin(): void $this->assertArrayHasKey(ContainerAwareTrait::class, $traits); $constants = $this->getClassConstants($this->reflection); $this->assertCount(1, $constants); - $this->assertArrayHasKey($this->plugin::TAG, $constants); + $this->assertArrayHasKey('TAG', $constants); } }