From abe47b79c898c49d762df5d0f52541722e8e202c Mon Sep 17 00:00:00 2001 From: Ben Muschol Date: Fri, 25 Aug 2017 20:25:58 -0400 Subject: Add check for HEAD ref in diagnostics --- Library/Homebrew/diagnostic.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index ceb6ad4d1..55124b91e 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -756,7 +756,7 @@ module Homebrew end end - def check_coretap_git_origin + def check_coretap_git_config coretap_path = CoreTap.instance.path return if !Utils.git_available? || !(coretap_path/".git").exist? @@ -785,6 +785,22 @@ module Homebrew git -C "#{coretap_path}" remote set-url origin #{Formatter.url("https://github.com/Homebrew/homebrew-core.git")} EOS end + + head = coretap_path.head + return unless head && head !~ %r{refs/heads/master} + + <<-EOS.undent + Suspicious #{CoreTap.instance} git head found. + + With a non-standard head, your local version of Homebrew might not + have all of the changes intended for the most recent release. The + current git head is: + #{head} + + Unless you have compelling reasons, consider setting the head to + point at the master branch by running: + git checkout master + EOS end def __check_linked_brew(f) -- cgit v1.2.3 From b351c3f3ff960f3a3a61d5738eb9e126889aac30 Mon Sep 17 00:00:00 2001 From: Ben Muschol Date: Fri, 25 Aug 2017 21:04:23 -0400 Subject: Fix method name --- Library/Homebrew/diagnostic.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 55124b91e..d5f1a61f2 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -786,7 +786,7 @@ module Homebrew EOS end - head = coretap_path.head + head = coretap_path.git_head return unless head && head !~ %r{refs/heads/master} <<-EOS.undent -- cgit v1.2.3 From 7b31dd606288cbd976015efde61b6a6e2eb17a38 Mon Sep 17 00:00:00 2001 From: Ben Muschol Date: Sat, 26 Aug 2017 08:25:08 -0400 Subject: Prefer if over unless, simplify messaging --- Library/Homebrew/diagnostic.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index d5f1a61f2..8108c5da0 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -787,19 +787,13 @@ module Homebrew end head = coretap_path.git_head - return unless head && head !~ %r{refs/heads/master} + return if head.nil? || head =~ %r{refs/heads/master} <<-EOS.undent - Suspicious #{CoreTap.instance} git head found. + Homebrew/homebrew-core is not on the master branch - With a non-standard head, your local version of Homebrew might not - have all of the changes intended for the most recent release. The - current git head is: - #{head} - - Unless you have compelling reasons, consider setting the head to - point at the master branch by running: - git checkout master + Check out the master branch by running: + git -C "$(brew --repo homebrew/core)" checkout master EOS end -- cgit v1.2.3