aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorBen Muschol2017-09-27 16:32:13 -0400
committerBen Muschol2017-09-27 16:32:13 -0400
commitfe5c885da0b8b69a5de74647e4181b137acb835f (patch)
tree769a9bd51965936583bc0d5e838bc7d54732d0ad /Library
parent204f37049122c1ab371a71ae12e8d16aa8ffb23f (diff)
downloadbrew-fe5c885da0b8b69a5de74647e4181b137acb835f.tar.bz2
Implement changes
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/diagnostic.rb13
-rw-r--r--Library/Homebrew/extend/git_repository.rb9
-rw-r--r--Library/Homebrew/tap.rb6
3 files changed, 28 insertions, 0 deletions
diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb
index ceb6ad4d1..f42fb95e2 100644
--- a/Library/Homebrew/diagnostic.rb
+++ b/Library/Homebrew/diagnostic.rb
@@ -785,6 +785,19 @@ 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 =~ %r{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 f232be428..acf2d196b 100644
--- a/Library/Homebrew/tap.rb
+++ b/Library/Homebrew/tap.rb
@@ -118,6 +118,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?