From 7d8eb69dfe0b5bb9ad685e1113a33eaec2b71c88 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 14 Mar 2024 11:48:34 +0000 Subject: [PATCH] install: use stable tag. Currently we always install onto the latest `master`. Instead, let's correctly use the latest tag. --- install.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 1c98712f..10c8a0f4 100755 --- a/install.sh +++ b/install.sh @@ -914,8 +914,14 @@ ohai "Downloading and installing Homebrew..." execute "${USABLE_GIT}" "fetch" "--force" "origin" execute "${USABLE_GIT}" "fetch" "--force" "--tags" "origin" + execute "${USABLE_GIT}" "remote" "set-head" "origin" "--auto" >/dev/null - execute "${USABLE_GIT}" "reset" "--hard" "origin/master" + LATEST_GIT_TAG="$("${USABLE_GIT}" tag --list --sort="-version:refname" | head -n1)" + if [[ -z "${LATEST_GIT_TAG}" ]] + then + abort "Failed to query latest Homebrew/brew Git tag." + fi + execute "${USABLE_GIT}" "checkout" "--force" "-B" "stable" "${LATEST_GIT_TAG}" if [[ "${HOMEBREW_REPOSITORY}" != "${HOMEBREW_PREFIX}" ]] then