Fix check_coretap_git_origin
check_coretap_git_origin was not working as intended. Permit Linuxbrew/homebrew-core as a valid origin. Factor out check_coretap_git_branch.
This commit is contained in:
parent
2cc50864cc
commit
d13a287954
@ -581,11 +581,9 @@ module Homebrew
|
|||||||
|
|
||||||
Without a correctly configured origin, Homebrew won't update
|
Without a correctly configured origin, Homebrew won't update
|
||||||
properly. You can solve this by adding the Homebrew remote:
|
properly. You can solve this by adding the Homebrew remote:
|
||||||
git -C "#{coretap_path}" remote add origin #{Formatter.url("https://github.com/Homebrew/homebrew-core.git")}
|
git -C "#{coretap_path}" remote add origin #{Formatter.url(CoreTap.instance.default_remote)}
|
||||||
EOS
|
EOS
|
||||||
elsif origin !~ %r{Homebrew/homebrew-core(\.git|/)?$}
|
elsif origin !~ %r{#{CoreTap.instance.full_name}(\.git|/)?$}
|
||||||
return if ENV["CI"] && origin.include?("Homebrew/homebrew-test-bot")
|
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Suspicious #{CoreTap.instance} git origin remote found.
|
Suspicious #{CoreTap.instance} git origin remote found.
|
||||||
|
|
||||||
@ -595,17 +593,22 @@ module Homebrew
|
|||||||
|
|
||||||
Unless you have compelling reasons, consider setting the
|
Unless you have compelling reasons, consider setting the
|
||||||
origin remote to point at the main repository by running:
|
origin remote to point at the main repository by running:
|
||||||
git -C "#{coretap_path}" remote set-url origin #{Formatter.url("https://github.com/Homebrew/homebrew-core.git")}
|
git -C "#{coretap_path}" remote set-url origin #{Formatter.url(CoreTap.instance.default_remote)}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_coretap_git_branch
|
||||||
return if ENV["CI"]
|
return if ENV["CI"]
|
||||||
|
|
||||||
|
coretap_path = CoreTap.instance.path
|
||||||
|
return if !Utils.git_available? || !(coretap_path/".git").exist?
|
||||||
|
|
||||||
branch = coretap_path.git_branch
|
branch = coretap_path.git_branch
|
||||||
return if branch.nil? || branch =~ /master/
|
return if branch.nil? || branch =~ /master/
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Homebrew/homebrew-core is not on the master branch
|
#{CoreTap.instance.full_name} is not on the master branch
|
||||||
|
|
||||||
Check out the master branch by running:
|
Check out the master branch by running:
|
||||||
git -C "$(brew --repo homebrew/core)" checkout master
|
git -C "$(brew --repo homebrew/core)" checkout master
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
class CoreTap < Tap
|
class CoreTap < Tap
|
||||||
def default_remote
|
# @private
|
||||||
if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
|
def initialize
|
||||||
"https://github.com/Homebrew/homebrew-core".freeze
|
super "Homebrew", "core"
|
||||||
else
|
@full_name = "Linuxbrew/homebrew-core" unless ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
|
||||||
"https://github.com/Linuxbrew/homebrew-core".freeze
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -635,10 +635,6 @@ end
|
|||||||
|
|
||||||
# A specialized {Tap} class for the core formulae.
|
# A specialized {Tap} class for the core formulae.
|
||||||
class CoreTap < Tap
|
class CoreTap < Tap
|
||||||
def default_remote
|
|
||||||
"https://github.com/Homebrew/homebrew-core".freeze
|
|
||||||
end
|
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def initialize
|
def initialize
|
||||||
super "Homebrew", "core"
|
super "Homebrew", "core"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user