Doctor check for origin
Added checks on doctor.rb for: * Missing git origin * git origin not pointing at mxcl/homebrew Tests use `git config --get remote.origin.url`. Also added printout of origin to --config.rb. Fixes Homebrew/homebrew#14399. Closes Homebrew/homebrew#17117. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
968782a31b
commit
8000fb807f
@ -54,6 +54,13 @@ module Homebrew extend self
|
|||||||
if head.empty? then "(none)" else head end
|
if head.empty? then "(none)" else head end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def origin
|
||||||
|
origin = HOMEBREW_REPOSITORY.cd do
|
||||||
|
`git config --get remote.origin.url`.chomp
|
||||||
|
end
|
||||||
|
if origin.empty? then "(none)" else origin end
|
||||||
|
end
|
||||||
|
|
||||||
def describe_path path
|
def describe_path path
|
||||||
return "N/A" if path.nil?
|
return "N/A" if path.nil?
|
||||||
realpath = path.realpath
|
realpath = path.realpath
|
||||||
@ -124,6 +131,7 @@ module Homebrew extend self
|
|||||||
|
|
||||||
def dump_verbose_config
|
def dump_verbose_config
|
||||||
puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
|
puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
|
||||||
|
puts "ORIGIN: #{origin}"
|
||||||
puts "HEAD: #{head}"
|
puts "HEAD: #{head}"
|
||||||
puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}"
|
puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}"
|
||||||
puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}"
|
puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}"
|
||||||
|
|||||||
@ -721,6 +721,44 @@ def check_git_newline_settings
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_for_git_origin
|
||||||
|
return unless which "git"
|
||||||
|
|
||||||
|
HOMEBREW_REPOSITORY.cd do
|
||||||
|
if `git config --get remote.origin.url`.chomp.empty? then <<-EOS.undent
|
||||||
|
Missing 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 add remote origin https://github.com/mxcl/homebrew.git
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_the_git_origin
|
||||||
|
return unless which "git"
|
||||||
|
return if check_for_git_origin
|
||||||
|
|
||||||
|
HOMEBREW_REPOSITORY.cd do
|
||||||
|
origin = `git config --get remote.origin.url`.chomp
|
||||||
|
|
||||||
|
unless origin =~ /mxcl\/homebrew\.git$/ then <<-EOS.undent
|
||||||
|
Suspicious 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:
|
||||||
|
https://github.com/mxcl/homebrew.git
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def check_for_autoconf
|
def check_for_autoconf
|
||||||
return unless MacOS::Xcode.provides_autotools?
|
return unless MacOS::Xcode.provides_autotools?
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user