mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #20186 from Homebrew/origin-head-fix
cmd/update: ensure we update remote main ref
This commit is contained in:
commit
4dabf8da16
@ -252,6 +252,7 @@ EOS
|
||||
fi
|
||||
|
||||
INITIAL_BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null)"
|
||||
SOFT_DELETE_MASTER=
|
||||
if [[ "${INITIAL_BRANCH}" == "master" &&
|
||||
("${DIR}" == "${HOMEBREW_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CASK_REPOSITORY}") ]]
|
||||
then
|
||||
@ -682,6 +683,16 @@ EOS
|
||||
UPSTREAM_REPOSITORY_TOKEN="${BASH_REMATCH[1]#*:}"
|
||||
fi
|
||||
|
||||
MAIN_MIGRATION_REQUIRED=
|
||||
if [[ "${UPSTREAM_BRANCH_DIR}" == "master" &&
|
||||
("${DIR}" == "${HOMEBREW_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CASK_REPOSITORY}") ]]
|
||||
then
|
||||
# Migrate master to main for Homebrew/brew, homebrew-core or homebrew-cask
|
||||
MAIN_MIGRATION_REQUIRED=1
|
||||
UPSTREAM_BRANCH_DIR="main"
|
||||
declare UPSTREAM_BRANCH"${TAP_VAR}"="main"
|
||||
fi
|
||||
|
||||
if [[ -n "${UPSTREAM_REPOSITORY}" ]]
|
||||
then
|
||||
# UPSTREAM_REPOSITORY_TOKEN is parsed (if exists) from UPSTREAM_REPOSITORY_URL
|
||||
@ -793,6 +804,11 @@ EOS
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "${MAIN_MIGRATION_REQUIRED}" ]]
|
||||
then
|
||||
git remote set-head origin --auto >/dev/null
|
||||
fi
|
||||
|
||||
rm -f "${tmp_failure_file}"
|
||||
) &
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user