diff options
| author | Mike McQuaid | 2017-03-26 20:28:11 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2017-03-26 20:28:11 +0100 |
| commit | 677db79c292f8e00662656e14f9c983230aff07a (patch) | |
| tree | 5b39df04a8cb9d1057c1e745f6fbcd21eb7b59ae /Library | |
| parent | a34f7277deda844a680f7c4726e46fd9c1bc8bbf (diff) | |
| download | brew-677db79c292f8e00662656e14f9c983230aff07a.tar.bz2 | |
diagnostic: check homebrew/core git remote.
Check the remote for homebrew/core as well as homebrew/brew as we've
seen a few cases (e.g. #2387) where it was misconfigured.
While we're here, tweak the messaging to tell people what to do and how
to do so with a single command.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/diagnostic.rb | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index c8c4b83d2..08c026f3c 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -794,31 +794,59 @@ module Homebrew EOS end - def check_git_origin + def check_brew_git_origin return if !Utils.git_available? || !(HOMEBREW_REPOSITORY/".git").exist? origin = HOMEBREW_REPOSITORY.git_origin if origin.nil? <<-EOS.undent - Missing git origin remote. + Missing Homebrew/brew git origin remote. Without a correctly configured origin, Homebrew won't update properly. You can solve this by adding the Homebrew remote: - cd #{HOMEBREW_REPOSITORY} - git remote add origin #{Formatter.url("https://github.com/Homebrew/brew.git")} + git -C "#{HOMEBREW_REPOSITORY}" remote add origin #{Formatter.url("https://github.com/Homebrew/brew.git")} EOS elsif origin !~ %r{Homebrew/brew(\.git)?$} <<-EOS.undent - Suspicious git origin remote found. + Suspicious Homebrew/brew git origin remote found. With a non-standard origin, Homebrew won't pull updates from the main repository. The current git origin is: #{origin} Unless you have compelling reasons, consider setting the - origin remote to point at the main repository, located at: - #{Formatter.url("https://github.com/Homebrew/brew.git")} + origin remote to point at the main repository by running: + git -C "#{HOMEBREW_REPOSITORY}" remote add origin #{Formatter.url("https://github.com/Homebrew/brew.git")} + EOS + end + end + + def check_coretap_git_origin + coretap_path = CoreTap.instance.path + return if !Utils.git_available? || !(coretap_path/".git").exist? + + origin = coretap_path.git_origin + + if origin.nil? + <<-EOS.undent + Missing #{CoreTap.instance} git origin remote. + + Without a correctly configured origin, Homebrew won't update + properly. You can solve this by adding the Homebrew remote: + git -C "#{coretap_path}" remote add origin #{Formatter.url("https://github.com/Homebrew/homebrew-core.git")} + EOS + elsif origin !~ %r{Homebrew/homebrew-core(\.git)?$} + <<-EOS.undent + Suspicious #{CoreTap.instance} git origin remote found. + + With a non-standard origin, Homebrew won't pull updates from + the main repository. The current git origin is: + #{origin} + + Unless you have compelling reasons, consider setting the + origin remote to point at the main repository by running: + git -C "#{coretap_path}" remote add origin #{Formatter.url("https://github.com/Homebrew/homebrew-core.git")} EOS end end |
