Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions Library/Homebrew/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,9 @@ def check_coretap_git_origin

Without a correctly configured origin, Homebrew won't update
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
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This string went nowhere.

elsif origin !~ %r{Homebrew/homebrew-core(\.git|/)?$}
return if ENV["CI"] && origin.include?("Homebrew/homebrew-test-bot")

elsif origin !~ %r{#{CoreTap.instance.full_name}(\.git|/)?$}
<<~EOS
Suspicious #{CoreTap.instance} git origin remote found.

Expand All @@ -595,17 +593,22 @@ def check_coretap_git_origin

Unless you have compelling reasons, consider setting the
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
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This string went nowhere.

end
end

def check_coretap_git_branch
return if ENV["CI"]

coretap_path = CoreTap.instance.path
return if !Utils.git_available? || !(coretap_path/".git").exist?

branch = coretap_path.git_branch
return if branch.nil? || branch =~ /master/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to update the string two lines below, too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean change Homebrew/homebrew-core is not on the master branch? Yep, can do.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sjackman 👍

<<~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:
git -C "$(brew --repo homebrew/core)" checkout master
Expand Down
10 changes: 4 additions & 6 deletions Library/Homebrew/extend/os/linux/tap.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
class CoreTap < Tap
def default_remote
if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
"https://github.com/Homebrew/homebrew-core".freeze
else
"https://github.com/Linuxbrew/homebrew-core".freeze
end
# @private
def initialize
super "Homebrew", "core"
@full_name = "Linuxbrew/homebrew-core" unless ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is properly overriding e.g.the path etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The aim here is to override only full_name and default_remote on Linux. The other variables should be identical on Linux as on macOS. In particular, CoreTap.instance.path is $HOMEBREW_PREFIX/Homebrew/Library/Taps/homebrew/homebrew-core.

$ brew irb <<<'CoreTap.instance.path'

<Pathname:/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core>

end
end
4 changes: 0 additions & 4 deletions Library/Homebrew/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,6 @@ def read_or_set_private_config

# A specialized {Tap} class for the core formulae.
class CoreTap < Tap
def default_remote
"https://github.com/Homebrew/homebrew-core".freeze
end

# @private
def initialize
super "Homebrew", "core"
Expand Down