aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2017-10-18 10:59:59 +0100
committerGitHub2017-10-18 10:59:59 +0100
commit3a606abaa13a3090f3c6336efed435006f091c60 (patch)
treea361933786386df0b3edc81a47707fcbab919dad /Library/Homebrew
parent1d541804c8ec90ef622c2a4d2519226e6f55d531 (diff)
parenta8ca47d294d1399393c4f066e0bebd356d500148 (diff)
downloadbrew-3a606abaa13a3090f3c6336efed435006f091c60.tar.bz2
Merge pull request #3229 from BenMusch/check-for-master-no-refactor
doctor: Check for branch of core tap (take 2)
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/diagnostic.rb12
-rw-r--r--Library/Homebrew/extend/git_repository.rb9
-rw-r--r--Library/Homebrew/tap.rb6
3 files changed, 27 insertions, 0 deletions
diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb
index baf04e332..9ab83c1a2 100644
--- a/Library/Homebrew/diagnostic.rb
+++ b/Library/Homebrew/diagnostic.rb
@@ -787,6 +787,18 @@ module Homebrew
git -C "#{coretap_path}" remote set-url origin #{Formatter.url("https://github.com/Homebrew/homebrew-core.git")}
EOS
end
+
+ return if ENV["CI"] || ENV["JENKINS_HOME"]
+
+ branch = coretap_path.git_branch
+ return if branch.nil? || branch =~ /master/
+
+ <<-EOS.undent
+ Homebrew/homebrew-core is not on the master branch
+
+ Check out the master branch by running:
+ git -C "$(brew --repo homebrew/core)" checkout master
+ EOS
end
def __check_linked_brew(f)
diff --git a/Library/Homebrew/extend/git_repository.rb b/Library/Homebrew/extend/git_repository.rb
index c15988550..6b89d175c 100644
--- a/Library/Homebrew/extend/git_repository.rb
+++ b/Library/Homebrew/extend/git_repository.rb
@@ -36,6 +36,15 @@ module GitRepositoryExtension
end
end
+ def git_branch
+ return unless git? && Utils.git_available?
+ cd do
+ Utils.popen_read(
+ "git", "rev-parse", "--abbrev-ref", "HEAD"
+ ).chuzzle
+ end
+ end
+
def git_last_commit_date
return unless git? && Utils.git_available?
cd do
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb
index 4b3cfc38a..c12c121e4 100644
--- a/Library/Homebrew/tap.rb
+++ b/Library/Homebrew/tap.rb
@@ -115,6 +115,12 @@ class Tap
path.git?
end
+ # git branch for this {Tap}.
+ def git_branch
+ raise TapUnavailableError, name unless installed?
+ path.git_branch
+ end
+
# git HEAD for this {Tap}.
def git_head
raise TapUnavailableError, name unless installed?