Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Doctor check for origin #17117

Closed
wants to merge 1 commit into from

4 participants

@urdh

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.

@urdh urdh 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.
589def6
@cooljeanius
  • git origin not pointing at mxcl/homebrew

The Homebrew wiki says (recommends) that corporations can set the origin to something else if they have modifications relevant to their coworkers: https://github.com/mxcl/homebrew/wiki/Installation

Perhaps this check could be disabled in this situation?

@urdh

The rationale in #14399 seemed to be that those cases are covered by ignoring the warning:

But if we consider that experienced users may change their origin, then experienced users can know to ignore the warning.

@jacknagel
Collaborator

I tend to agree.

Thanks for the contribution!

@jacknagel jacknagel closed this pull request from a commit
@urdh urdh 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 #14399.
Closes #17117.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
6bbb92f
@jacknagel jacknagel closed this in 6bbb92f
@urdh urdh deleted the urdh:doctor-origin branch
@asharpe asharpe referenced this pull request from a commit
@urdh urdh 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 #14399.
Closes #17117.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
b2b4e8a
@norioxkimura norioxkimura referenced this pull request from a commit in norioxkimura/homebrew
@urdh urdh 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 #14399.
Closes #17117.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
54ac9f3
@cooljeanius cooljeanius referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@Sharpie Sharpie referenced this pull request from a commit in Sharpie/homebrew
@urdh urdh 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 #14399.
Closes #17117.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
3df7983
@phoet

running brew docotor on a clean installation brings:

$ brew doctor
Warning: Suspicious git origin remote found.

With a non-standard origin, Homebrew won't pull updates from
the main repository. The current git origin is:


Unless you have compelling reasons, consider setting the
origin remote to point at the main repository, located at:
  https://github.com/mxcl/homebrew.git

running brew update one time fixes it.

@rajeeja rajeeja referenced this pull request from a commit
@urdh urdh 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 #14399.
Closes #17117.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
48f45b4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 16, 2013
  1. @urdh

    Doctor check for origin

    urdh authored
    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.
This page is out of date. Refresh to see the latest.
Showing with 48 additions and 0 deletions.
  1. +8 −0 Library/Homebrew/cmd/--config.rb
  2. +40 −0 Library/Homebrew/cmd/doctor.rb
View
8 Library/Homebrew/cmd/--config.rb
@@ -54,6 +54,13 @@ def head
if head.empty? then "(none)" else head 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
return "N/A" if path.nil?
realpath = path.realpath
@@ -124,6 +131,7 @@ def write_build_config f
def dump_verbose_config
puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
+ puts "ORIGIN: #{origin}"
puts "HEAD: #{head}"
puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}"
puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}"
View
40 Library/Homebrew/cmd/doctor.rb
@@ -721,6 +721,46 @@ def check_git_newline_settings
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
+
+ Developments can be pushed to a non-origin remote.
+ EOS
+ end
+ end
+end
+
def check_for_autoconf
return unless MacOS::Xcode.provides_autotools?
Something went wrong with that request. Please try again.