New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix check_coretap_git_origin #5607
Fix check_coretap_git_origin #5607
Conversation
|
||
if origin.nil? | ||
<<~EOS | ||
Missing #{CoreTap.instance} git origin remote. | ||
|
||
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(default_remote)} | ||
EOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string went nowhere.
@@ -595,12 +596,17 @@ 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(default_remote)} | |||
EOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string went nowhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One change request then good to go 👍
Library/Homebrew/diagnostic.rb
Outdated
EOS | ||
elsif origin !~ %r{Homebrew/homebrew-core(\.git|/)?$} | ||
elsif origin !~ %r{#{URI(default_remote).path}(\.git|/)?$} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CoreTap.instance.full_name
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Linux, CoreTap.instance.full_name
returns Homebrew/homebrew-core
rather than the desired Linuxbrew/homebrew-core
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to use…
elsif origin != default_remote
It's stricter in three ways:
- Doesn't allow trailing
.git
- Doesn't allow trailing
/
- Doesn't allow
ssh
I'm personally okay with that. Homogeneity is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think about it, it's simply a bug that CoreTap.instance.full_name
returns Homebrew/homebrew-core on Linux. I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think about it, it's simply a bug that
CoreTap.instance.full_name
returns Homebrew/homebrew-core on Linux. I'll fix it.
👍
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/ | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3d3d0dc
to
d523ea6
Compare
I'm not able to reproduce this error locally.
The curent @MikeMcQuaid Any idea why the regex is not matching? elsif origin !~ %r{#{CoreTap.instance.full_name}(\.git|/)?$} |
CI passed on macOS, and failed on Linux. |
@sjackman Only for uploading bottles. It's doing |
This failure is correct; that origin is wrong on Linux. |
Library/Homebrew/diagnostic.rb
Outdated
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed now by the way.
# @private | ||
def initialize | ||
super "Homebrew", "core" | ||
@full_name = "Linuxbrew/homebrew-core" unless ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
check_coretap_git_origin was not working as intended. Permit Linuxbrew/homebrew-core as a valid origin. Factor out check_coretap_git_branch.
d523ea6
to
d13a287
Compare
I found the problem. The generic |
💚 Ready for re-review. |
Thanks @sjackman! |
Thanks for merging, Mike! |
check_coretap_git_origin was not working as intended.
Permit Linuxbrew/homebrew-core as a valid origin.
Factor out check_coretap_git_branch.
brew style
with your changes locally?brew tests
with your changes locally?