-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Allow for default branch change on custom tap #7746
Comments
What command are you running to produce this output? |
Thinking about this more:
I'm 99% sure you're seeing that Git/GitHub do not support "renaming branches". As far as all local Git checkouts of your repository (which is what a Homebrew tap is) are concerned: you have deleted the |
Wow, yeah, this is tricky with git. Renaming the branch is easy with
And cleaning up doesn't work.
Most suggestions online say you should, "just delete the .git folder and recheck out the repo," which isn't very helpful for our purposes. Reading through
I can think of some hacky ways around this for Homebrew, but I'm beginning to think this is not your problem to solve. I'll leave this open in case others have ideas. |
Yup 😭.
Sadly, I agree. This is something probably best raised with GitHub and/or Git directly.
As per-usual on our issue tracker: I'm going to close this out as there's no actionable work for Homebrew maintainers or contributors. I'll pin this (closed) issue, though, so others can see it. |
Hi, James. I created PR #7758 to fetch brew update-reset $(brew --repo tugboatqa/tugboat) You could also simply |
@q0rban PRs #7758 and #7769 have been merged, and Homebrew 2.4.1 including this fix has been tagged and released. https://github.com/Homebrew/brew/releases/tag/2.4.1 Does |
@sjackman wow, fantastic work! We ended up sticking with |
😁Thanks! It's possible that |
We gave this a shot and were still getting errors.
So, I think we will keep the master branch around for a while and ship a new version that outputs a warning message on how to update. |
😢 A PR to fix this issue is welcome if you'd like to open one. If you have a halfway working fix, and want to discuss it, you can open a draft PR, and we can chat there. |
@MikeMcQuaid I believe that this feature does work for deep clones:
There does appear to be a problem with shallow though:
|
Thank you for the reproducible example, Ben, and how strange! |
@sjackman I think the explanation is that when you shallow clone, it adds a bunch of restrictions to that clone. For example, the
So my guess is that one of those limitations is that you can't swap the I was doing a bunch of experimentation this morning and there are a couple of reasonable strategies for making this migration, but what holds me up from suggesting or PR-ing any of them is that I haven't yet found how to use the Git command line to determine what a remote's default |
I had to read the $ git remote show origin | grep HEAD
HEAD branch: develop |
Yeah, so extracting that and doing something useful requires |
Based on my searching of the Git codebase, I don't believe there is another way to fetch the default branch other than $ curl -s https://api.github.com/repos/brewsci/homebrew-bio | jq -r .default_branch
develop sed or awk is just fine in this case. $ git remote show origin | awk '/^ HEAD branch: / {print $3}'
develop |
Our workaround, in case it is helpful for others, is to add a script to the master branch that outputs a warning and error with instructions on how to upgrade https://github.com/TugboatQA/homebrew-tugboat/blob/master/Formula/tugboat-cli.rb class TugboatCli < Formula
desc "Tugboat CLI"
homepage "https://tugboat.qa"
url "https://dashboard.tugboat.qa/cli/macos/tugboat.tar.gz"
version "2.20.33"
ohai "Language Matters"
opoo "Tugboat is updating its language in an effort to be more inclusive."
opoo "Part of that effort includes renaming our default git branches from"
opoo "'master' to 'main'. Read more at"
opoo ""
opoo " https://www.tugboat.qa/language-matters"
opoo ""
odie """To upgrade tugboat-cli, retap it with:
brew untap tugboatqa/tugboat
brew tap tugboatqa/tugboat
brew upgrade tugboat-cli"""
end Which then results in: |
Tricksy! Nice hack. |
… upgrading Relates to Homebrew/brew#7746
… upgrading Relates to Homebrew/brew#7746
… upgrading Relates to Homebrew/brew#7746
A detailed description of the proposed feature
Over at Tugboat, we're working on updating our various GitHub repositories to switch the default branch from
master
tomain
, per https://tools.ietf.org/html/draft-knodel-terminology-01. As such, we went to update the default branch for the Homebrew Tap for our CLI. After adding a newmain
branch and deleting themaster
branch, it seems that existing installs of our CLI with Homebrew fail with the following message:Would it be feasible to allow for branch renaming on taps without breaking existing installs?
The motivation for the feature
Allowing for Homebrew developers to change their default branch without breaking existing installations.
How the feature would be relevant to at least 90% of Homebrew users
Allowing for Homebrew developers to change their default branch without breaking existing installations.
What alternatives to the feature have been considered
I cannot think of alternatives.
The text was updated successfully, but these errors were encountered: