check before examine_git_origin

This commit is contained in:
hyuraku 2019-12-19 00:05:20 +09:00
parent bdf493b673
commit 7501f3d402
2 changed files with 7 additions and 6 deletions

View File

@ -374,6 +374,9 @@ then
export HOMEBREW_BOTTLE_DOMAIN="$HOMEBREW_BOTTLE_DEFAULT_DOMAIN"
fi
export HOMEBREW_BREW_REMOTE
export HOMEBREW_DEFAULT_CORE_REMOTE
HOMEBREW_DEFAULT_BREW_REMOTE="https://github.com/Homebrew/brew.git"
if [[ -z "$HOMEBREW_BREW_REMOTE" ]]
then
@ -387,9 +390,6 @@ else
HOMEBREW_DEFAULT_CORE_REMOTE="https://github.com/Homebrew/linuxbrew-core"
fi
export HOMEBREW_BREW_REMOTE
export HOMEBREW_DEFAULT_CORE_REMOTE
if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]]
then
HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh"

View File

@ -113,7 +113,7 @@ module Homebrew
return if !Utils.git_available? || !repository_path.git?
current_origin = repository_path.git_origin
user_origins = [HOMEBREW_BREW_REMOTE, HOMEBREW_CORE_REMOTE]
if current_origin.nil?
<<~EOS
Missing #{desired_origin} git origin remote.
@ -122,8 +122,7 @@ module Homebrew
properly. You can solve this by adding the remote:
git -C "#{repository_path}" remote add origin #{Formatter.url("https://github.com/#{desired_origin}.git")}
EOS
elsif !current_origin.match?(%r{#{desired_origin}(\.git|/)?$}i) && \
!user_origins.include?(current_origin)
elsif !current_origin.match?(%r{#{desired_origin}(\.git|/)?$}i)
<<~EOS
Suspicious #{desired_origin} git origin remote found.
The current git origin is:
@ -561,10 +560,12 @@ module Homebrew
end
def check_brew_git_origin
return if HOMEBREW_BREW_REMOTE == HOMEBREW_REPOSITORY.git_origin
examine_git_origin(HOMEBREW_REPOSITORY, "Homebrew/brew")
end
def check_coretap_git_origin
return if HOMEBREW_BREW_REMOTE == CoreTap.instance.path.git_origin
examine_git_origin(CoreTap.instance.path, CoreTap.instance.full_name)
end