mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #20175 from Homebrew/migrate_brew_cask_main
cmd/update: improve Homebrew/brew and homebrew-cask `main` migration.
This commit is contained in:
commit
66c11afa7c
@ -252,6 +252,14 @@ EOS
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
INITIAL_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null)"
|
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}" ]] ||
|
if [[ -n "${UPSTREAM_TAG}" ]] ||
|
||||||
[[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" ]]
|
[[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" ]]
|
||||||
then
|
then
|
||||||
@ -328,6 +336,11 @@ EOS
|
|||||||
pop_stash_message
|
pop_stash_message
|
||||||
fi
|
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
|
trap - SIGINT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user