Merge pull request #6929 from MikeMcQuaid/improve_git_remote
Improve handling of *_GIT_REMOTE env vars
This commit is contained in:
commit
1640d96855
@ -30,6 +30,10 @@ git_init_if_necessary() {
|
|||||||
trap '{ rm -rf .git; exit 1; }' EXIT
|
trap '{ rm -rf .git; exit 1; }' EXIT
|
||||||
git init
|
git init
|
||||||
git config --bool core.autocrlf false
|
git config --bool core.autocrlf false
|
||||||
|
if [[ "$HOMEBREW_DEFAULT_BREW_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]]
|
||||||
|
then
|
||||||
|
echo "HOMEBREW_BREW_GIT_REMOTE set: using $HOMEBREW_BREW_GIT_REMOTE for Homebrew/brew Git remote URL."
|
||||||
|
fi
|
||||||
git config remote.origin.url "$HOMEBREW_BREW_GIT_REMOTE"
|
git config remote.origin.url "$HOMEBREW_BREW_GIT_REMOTE"
|
||||||
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||||
latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)"
|
latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)"
|
||||||
@ -48,6 +52,10 @@ git_init_if_necessary() {
|
|||||||
trap '{ rm -rf .git; exit 1; }' EXIT
|
trap '{ rm -rf .git; exit 1; }' EXIT
|
||||||
git init
|
git init
|
||||||
git config --bool core.autocrlf false
|
git config --bool core.autocrlf false
|
||||||
|
if [[ "$HOMEBREW_DEFAULT_CORE_GIT_REMOTE" != "$HOMEBREW_CORE_GIT_REMOTE" ]]
|
||||||
|
then
|
||||||
|
echo "HOMEBREW_CORE_GIT_REMOTE set: using $HOMEBREW_CORE_GIT_REMOTE for Homebrew/core Git remote URL."
|
||||||
|
fi
|
||||||
git config remote.origin.url "$HOMEBREW_CORE_GIT_REMOTE"
|
git config remote.origin.url "$HOMEBREW_CORE_GIT_REMOTE"
|
||||||
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||||
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master
|
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master
|
||||||
@ -397,6 +405,7 @@ EOS
|
|||||||
if [[ "$HOMEBREW_DEFAULT_BREW_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]]
|
if [[ "$HOMEBREW_DEFAULT_BREW_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]]
|
||||||
then
|
then
|
||||||
safe_cd "$HOMEBREW_REPOSITORY"
|
safe_cd "$HOMEBREW_REPOSITORY"
|
||||||
|
echo "HOMEBREW_BREW_GIT_REMOTE set: using $HOMEBREW_BREW_GIT_REMOTE for Homebrew/brew Git remote."
|
||||||
git remote set-url origin "$HOMEBREW_BREW_GIT_REMOTE"
|
git remote set-url origin "$HOMEBREW_BREW_GIT_REMOTE"
|
||||||
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||||
latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)"
|
latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)"
|
||||||
@ -407,6 +416,7 @@ EOS
|
|||||||
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]]
|
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]]
|
||||||
then
|
then
|
||||||
safe_cd "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core"
|
safe_cd "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core"
|
||||||
|
echo "HOMEBREW_CORE_GIT_REMOTE set: using $HOMEBREW_CORE_GIT_REMOTE for Homebrew/brew Git remote."
|
||||||
git remote set-url origin "$HOMEBREW_CORE_GIT_REMOTE"
|
git remote set-url origin "$HOMEBREW_CORE_GIT_REMOTE"
|
||||||
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||||
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master
|
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master
|
||||||
|
|||||||
@ -648,6 +648,15 @@ class CoreTap < Tap
|
|||||||
safe_system HOMEBREW_BREW_FILE, "tap", instance.name
|
safe_system HOMEBREW_BREW_FILE, "tap", instance.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def install(options = {})
|
||||||
|
if HOMEBREW_CORE_GIT_REMOTE != default_remote
|
||||||
|
puts "HOMEBREW_CORE_GIT_REMOTE set: using #{HOMEBREW_CORE_GIT_REMOTE} " \
|
||||||
|
"for Homebrew/core Git remote URL."
|
||||||
|
options[:clone_target] ||= HOMEBREW_CORE_GIT_REMOTE
|
||||||
|
end
|
||||||
|
super(options)
|
||||||
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def uninstall
|
def uninstall
|
||||||
raise "Tap#uninstall is not available for CoreTap"
|
raise "Tap#uninstall is not available for CoreTap"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user