Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
40.96k stars 9.61k forks source link

Use `main` for Homebrew branches #17296

Open MikeMcQuaid opened 4 months ago

MikeMcQuaid commented 4 months ago

Verification

Provide a detailed description of the proposed feature

Homebrew should move to using the now GitHub and Git default of main for our branches.

We should start with less used taps e.g. Homebrew/homebrew-formula-analytics, move to more widely used taps Homebrew/homebrew-services, do so on Homebrew/homebrew-formula-core and Homebrew/homebrew-cask and end with Homebrew/brew.

It will be important to ensure that brew update, brew update-reset and brew test-bot all behave as expected.

What is the motivation for the feature?

Consistency across GitHub.

How will the feature be relevant to at least 90% of Homebrew users?

It's not.

What alternatives to the feature have been considered?

Leaving everything as master.

gibfahn commented 4 months ago

It will be important to ensure that brew update, brew update-reset and brew test-bot all behave as expected.

To confirm, "behave as expected" here means that e.g. brew update will seamlessly move the tap branch from master -> main right? if I recall correctly last time I tried this it instead errored and asked you to run brew tap --repair, which seems like something brew could handle for you.

https://github.com/homebrew/brew/blob/0a358b851875d8fe070396a7870a7f9b0dfc1634/Library/Homebrew/cmd/update-report.rb#L263-L269

Bo98 commented 4 months ago

Ideally yeah. And if any fixes are required, it may mean having to keep a copy of master around indefinitely as an intermediate update step.

If it doesn't work well, a local symbolic-ref might be an alternative idea.

MikeMcQuaid commented 4 months ago

To confirm, "behave as expected" here means that e.g. brew update will seamlessly move the tap branch from master -> main right?

Yes.

And if any fixes are required, it may mean having to keep a copy of master around indefinitely as an intermediate update step.

Ideally we don't want to do this but agreed it's worth doing if needed (at least on Homebrew/brew).

unitof commented 4 months ago

In the past, third party taps handled this with opoo but a silent method for renaming the main (or any) branch which doesn't require keeping the old branch around would be welcome.

rrotter commented 3 months ago

Noting the "help wanted" tag, I'm interested in working on this, but I'm not clear what the action item is, or at least not what work there is that a non-maintainer could do (i.e. I clearly won't be renaming your repos on GitHub).

I tried renaming the main branch on a personal tap: brew update detects the rename, and recommends running brew tap --repair, which in turn works perfectly for correcting the refs in the tap.

Is the next step just adding logic to brew update to run brew tap --repair (or the equivalent ruby command) automatically when a branch rename is detected?

edit: I guess I should say that tap --repair works almost perfectly. After the rename there is still a ref left behind to remotes/origin/oldname, which git remote prune origin fixes.

MikeMcQuaid commented 3 months ago

Is the next step just adding logic to brew update to run brew tap --repair (or the equivalent ruby command) automatically when a branch rename is detected?

Thanks for asking @rrotter! Yes, I think so. brew update should be able to handle these changes and run the relevant commands automatically for users with no intervention (although perhaps an ohai notifying them of the default branch change.

When you've verified this with some test personal taps: we can start moving some of the lesser used Homebrew official taps over.