mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
cmd/update: improve Homebrew/brew main
migration.
Let's avoid people sticking on the `master` branch unnecessarily.
This commit is contained in:
parent
dfe8fde704
commit
f649587d51
@ -252,6 +252,14 @@ EOS
|
||||
fi
|
||||
|
||||
INITIAL_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null)"
|
||||
if [[ "${INITIAL_BRANCH}" == "master" &&
|
||||
("${DIR}" == "${HOMEBREW_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CASK_REPOSITORY}") ]]
|
||||
then
|
||||
# Migrate master to main for Homebrew/brew or Homebrew/homebrew-cask
|
||||
INITIAL_BRANCH="main"
|
||||
SOFT_DELETE_MASTER="1"
|
||||
fi
|
||||
|
||||
if [[ -n "${UPSTREAM_TAG}" ]] ||
|
||||
[[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" ]]
|
||||
then
|
||||
@ -328,6 +336,11 @@ EOS
|
||||
pop_stash_message
|
||||
fi
|
||||
|
||||
if [[ "${SOFT_DELETE_MASTER}" == 1 && -n "$(git config branch.main.remote 2>/dev/null || true)" ]]
|
||||
then
|
||||
git branch -d "${QUIET_ARGS[@]}" master
|
||||
fi
|
||||
|
||||
trap - SIGINT
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user