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
Don't uninstall stable
keg with --HEAD
#11438
Conversation
I may be backtracking a bit on what I said in #11397 but I wonder if what needs to be fixed is that installing a stable version doesn't remove the I think that's more consistent with what we do elsewhere in Homebrew (i.e. installing a formula removes the other versions unless Is there a specific reason you have in mind for this? |
It would make it easier to have
That is true, but I think that the inconsistency could be warranted. Also, installing a formula only removes older versions unless
This is a fair option as well. The use case I'm describing may be rare enough where it makes sense to require users to set |
I'm happy to make changes if you'd like to go in the other direction. |
Yeah, I see you're point. I guess I'm not sure what the best thing is. Let's get some feedback from other maintainers. |
I'd find this useful. I also view On the other hand, we've removed support for switching between arbitrary versions of formulae on purpose, and perhaps some of the reasons we did that apply here. |
In that case, I'm fine with this change. To me, switching between arbitrary version does feel different from switching between a head and stable version, so I think this change is fine. I think, though, that the change should probably be made to the |
Good point, my mistake. I've pushed a fix.
|
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.
Looks good to me, thanks @cnnrmnn!
Hmm, how do you re-link the stable version once you've installed a HEAD version? If I check out this PR and install a stable version, then install the head version, then try to link the stable version with |
Just to be sure: With this PR, if I have the stable version of What about if I have |
Okay, I think the issue I was having was that this PR was created before #11397 was merged. Here's what I did to test (after rebasing the PR). I used $ brew install htop # install stable version
$ ls $(brew --cellar htop)
3.0.5
$ brew unlink htop
Unlinking /usr/local/Cellar/htop/3.0.5... 5 symlinks removed.
$ brew install --HEAD htop # install HEAD version
$ ls $(brew --cellar htop)
3.0.5 HEAD-c752c54
$ brew unlink htop
Unlinking /usr/local/Cellar/htop/HEAD-c752c54... 5 symlinks removed.
$ brew link htop
Linking /usr/local/Cellar/htop/3.0.5... 5 symlinks created.
$ brew unlink htop
Unlinking /usr/local/Cellar/htop/3.0.5... 5 symlinks removed.
$ brew link --HEAD htop
Linking /usr/local/Cellar/htop/HEAD-c752c54... 5 symlinks created.
$ brew uninstall --force htop # uninstall everything
$ brew install --HEAD htop # try installing HEAD first this time
$ ls $(brew --cellar htop)
HEAD-c752c54
$ brew unlink htop
Unlinking /usr/local/Cellar/htop/HEAD-c752c54... 5 symlinks removed.
$ brew install htop # links stable version
$ ls $(brew --cellar htop)
3.0.5 HEAD-c752c54
$ brew unlink htop
Unlinking /usr/local/Cellar/htop/3.0.5... 5 symlinks removed.
$ brew link htop
Linking /usr/local/Cellar/htop/3.0.5... 5 symlinks created.
$ brew unlink htop
Unlinking /usr/local/Cellar/htop/3.0.5... 5 symlinks removed.
$ brew link --HEAD htop
Linking /usr/local/Cellar/htop/HEAD-c752c54... 5 symlinks created. Everything there looks good to me. Does that help, @carlocab? Is there something else to test? |
This reverts commit b9b78478dbaf32605623563604b6fde8a8f3eeec.
feddf8b
to
ab822ce
Compare
Did I do that incorrectly? I had to force push it. I ran |
You did fine. |
You're good! You do need to force push after a rebase because you're modifying the history of the commits on the PR branch rather than just adding new ones. Here's a quick article about rebase in case you're curious: https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase or https://www.atlassian.com/git/tutorials/merging-vs-rebasing |
I think this is a regression:
It seems if I have an older |
Is there an easy way to determine which |
Not that I know of... I know
Simulating an old |
I think I've got it. PR opened: #11475 |
Thanks for the fix, @Rylan12! Sorry I couldn't get to it myself; I've been traveling. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?At the moment, installing the
head
version of a formula withbrew install --HEAD
uninstalls thestable
version of the formula if it is installed. This is obviously undesirable if you want to have thehead
andstable
versions of a formula installed simultaneously.This behavior seemed odd when I first discovered it, but it's actually the product of
brew install
uninstalling any kegs that have older versions than the one being installed. Thestable
keg is obviously older than thehead
keg, so it's uninstalled.This PR changes
brew install
so that it doesn't do any clean-up if--HEAD
is given.