aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2017-03-28 19:34:45 +0100
committerGitHub2017-03-28 19:34:45 +0100
commita543cb2f9e6d3a54a001e2cdd859fb4161f4b092 (patch)
treed43b4325362c93854c830a1f0859ceddc674a44e
parentdaa88ee6535a32fc449d849ba06045fe249b23a0 (diff)
parent677db79c292f8e00662656e14f9c983230aff07a (diff)
downloadbrew-a543cb2f9e6d3a54a001e2cdd859fb4161f4b092.tar.bz2
Merge pull request #2398 from MikeMcQuaid/doctor-check-homebrew-core
diagnostic: check homebrew/core git remote.
-rw-r--r--Library/Homebrew/diagnostic.rb42
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