update: change repo remotes to HTTPS if possible

Older systems will install Homebrew via git://, but can switch to https:// if a newer curl is installed.
This commit is contained in:
EricFromCanada 2018-11-14 13:32:41 -05:00
parent 81e2fbd032
commit e20ccfdb53

View File

@ -428,6 +428,15 @@ EOS
safe_cd "$HOMEBREW_REPOSITORY" safe_cd "$HOMEBREW_REPOSITORY"
# if an older system had a newer curl installed, change each repo's remote URL from GIT to HTTPS
if [[ -n "$HOMEBREW_SYSTEM_CURL_TOO_OLD" &&
-x "$HOMEBREW_PREFIX/opt/curl/bin/curl" &&
"$(git config remote.origin.url)" =~ ^git:// ]]
then
git config remote.origin.url "$BREW_OFFICIAL_REMOTE"
git config -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/config" remote.origin.url "$CORE_OFFICIAL_REMOTE"
fi
# kill all of subprocess on interrupt # kill all of subprocess on interrupt
trap '{ /usr/bin/pkill -P $$; wait; exit 130; }' SIGINT trap '{ /usr/bin/pkill -P $$; wait; exit 130; }' SIGINT