From 85cd2f075e57aef46f265ea1af2da67729af3748 Mon Sep 17 00:00:00 2001 From: Darren Kavanagh Date: Wed, 8 May 2024 13:53:10 -0700 Subject: [PATCH] cmd/update.sh: check initial branch is not master Check that the initial branch is not 'master' before doing a forced update on 'master'. Git will fail with fatal error otherwise. --- Library/Homebrew/cmd/update.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index b3806891df..4a6ad15dfd 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -266,7 +266,8 @@ EOS then git checkout --force "${UPSTREAM_BRANCH}" "${QUIET_ARGS[@]}" else - if [[ -n "${UPSTREAM_TAG}" && "${UPSTREAM_BRANCH}" != "master" ]] + if [[ -n "${UPSTREAM_TAG}" && "${UPSTREAM_BRANCH}" != "master" ]] && + [[ "${INITIAL_BRANCH}" != "master" ]] then git branch --force "master" "origin/master" "${QUIET_ARGS[@]}" fi