Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Use bash pattern mathing instead of grep for macOS compatibility (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
Atry authored Mar 30, 2022
1 parent fbb5bb6 commit 6c9b9f5
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions bin/test-build-on-all-distros
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@ fi

SOURCE_DIR="$1"
shift

pushd "$(dirname "$0")" >/dev/null
MINOR=$(git branch -r | grep -Po '(?<=origin/HHVM-4.)[0-9]+' | sort -rn | head -1)
popd >/dev/null
if [ -z "$MINOR" ]; then
echo "Failed to get the latest packaging branch name."
BRANCH=$(cd "$SOURCE_DIR" && git branch --show-current)
if [[ "$BRANCH" =~ HHVM-4.([0-9]+) ]]
then
MINOR="${BASH_REMATCH[1]}"
else
for BRANCH in $(cd "$(dirname "$0")" && git branch -r --sort=-refname)
do
if [[ "$BRANCH" =~ HHVM-4.([0-9]+) && (-z "$MINOR" || "${BASH_REMATCH[1]}" -gt "$MINOR") ]]
then
MINOR="${BASH_REMATCH[1]}"
fi
done
fi
if [[ -z "$MINOR" ]]
then
echo "Failed to get the latest packaging branch name." >&2
exit 1
fi

Expand Down

0 comments on commit 6c9b9f5

Please sign in to comment.