From fb86e96fcdde07587349399d633503eb8fa8d398 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 14 Mar 2024 11:42:47 +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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 1c98712f..a2215efd 100755 --- a/install.sh +++ b/install.sh @@ -914,8 +914,13 @@ 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