From 6fab5b0976addc7e8e772d86070358a55a38d281 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Sat, 26 Aug 2017 10:13:43 -0700 Subject: Revert "diagnostic: also don't check Jenkins core branch." This reverts commit db41f9d1182ff8c4c3b42b458e38d5c58b496ffb. --- 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 ef9f06569..3d3c5e5dc 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -786,7 +786,7 @@ module Homebrew EOS end - return if ENV["CI"] || ENV["JENKINS_HOME"] + return if ENV["CI"] head = coretap_path.git_head return if head.nil? || head =~ %r{refs/heads/master} -- cgit v1.2.3 From 8b91018c70cb949fdc90f3316eca0d386f7f09c1 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Sat, 26 Aug 2017 10:14:23 -0700 Subject: Revert "diagnostic: don't check CI core branch." This reverts commit cb5b14307ca4640e1ba68cfd28e7fef34a3b771b. --- Library/Homebrew/diagnostic.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 3d3c5e5dc..8108c5da0 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -786,7 +786,6 @@ module Homebrew EOS end - return if ENV["CI"] head = coretap_path.git_head return if head.nil? || head =~ %r{refs/heads/master} -- cgit v1.2.3 From 204f37049122c1ab371a71ae12e8d16aa8ffb23f Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Sat, 26 Aug 2017 10:15:35 -0700 Subject: Revert "Add check for HEAD ref in diagnostics" --- Library/Homebrew/diagnostic.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 8108c5da0..ceb6ad4d1 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -756,7 +756,7 @@ module Homebrew end end - def check_coretap_git_config + def check_coretap_git_origin coretap_path = CoreTap.instance.path return if !Utils.git_available? || !(coretap_path/".git").exist? @@ -785,16 +785,6 @@ module Homebrew git -C "#{coretap_path}" remote set-url origin #{Formatter.url("https://github.com/Homebrew/homebrew-core.git")} EOS end - - head = coretap_path.git_head - return if head.nil? || head =~ %r{refs/heads/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) -- cgit v1.2.3 From fe5c885da0b8b69a5de74647e4181b137acb835f Mon Sep 17 00:00:00 2001 From: Ben Muschol Date: Wed, 27 Sep 2017 16:32:13 -0400 Subject: Implement changes --- Library/Homebrew/diagnostic.rb | 13 +++++++++++++ Library/Homebrew/extend/git_repository.rb | 9 +++++++++ Library/Homebrew/tap.rb | 6 ++++++ 3 files changed, 28 insertions(+) (limited to 'Library/Homebrew') 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? -- cgit v1.2.3 From 7974ce24b619f921071dc607f0ea1a50e5379b9f Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 28 Sep 2017 20:10:06 +0100 Subject: Fix regex style --- 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 020594f0c..29d2e342f 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -789,7 +789,7 @@ module Homebrew return if ENV["CI"] || ENV["JENKINS_HOME"] branch = coretap_path.git_branch - return if branch.nil? || branch =~ %r{master} + return if branch.nil? || branch =~ /master/ <<-EOS.undent -- cgit v1.2.3 From a8ca47d294d1399393c4f066e0bebd356d500148 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 1 Oct 2017 19:07:10 +0100 Subject: diagnostic: remove unnecessary blank line. --- Library/Homebrew/diagnostic.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 29d2e342f..065f04240 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -791,7 +791,6 @@ module Homebrew branch = coretap_path.git_branch return if branch.nil? || branch =~ /master/ - <<-EOS.undent Homebrew/homebrew-core is not on the master branch -- cgit v1.2.3