brew icon indicating copy to clipboard operation
brew copied to clipboard

Use `main` for Homebrew branches

Open MikeMcQuaid opened this issue 1 year ago • 11 comments

Verification

  • [X] This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

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.

MikeMcQuaid avatar May 14 '24 07:05 MikeMcQuaid

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

gibfahn avatar May 15 '24 22:05 gibfahn

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.

Bo98 avatar May 16 '24 01:05 Bo98

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).

MikeMcQuaid avatar May 16 '24 02:05 MikeMcQuaid

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.

unitof avatar May 27 '24 16:05 unitof

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.

rrotter avatar Jul 02 '24 03:07 rrotter

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.

MikeMcQuaid avatar Jul 02 '24 07:07 MikeMcQuaid