From 7501f3d4020660c5965803fdc2b06432b31d329e Mon Sep 17 00:00:00 2001 From: hyuraku <32809703+hyuraku@users.noreply.github.com> Date: Thu, 19 Dec 2019 00:05:20 +0900 Subject: [PATCH] check before examine_git_origin --- Library/Homebrew/brew.sh | 6 +++--- Library/Homebrew/diagnostic.rb | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 383f790321..0974a6e2e3 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -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" diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index d6ccf2f4f4..71529d798f 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -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