Skip to content
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 unlock dependencies of a gemspec when its version changes #6184

Merged
merged 2 commits into from
Dec 23, 2022

Conversation

deivid-rodriguez
Copy link
Member

What was the end-user or developer problem that led to this PR?

When working with a gem locally with a Gemfile like

# frozen_string_literal: true

source "https://rubygems.org"

# Specify your gem's dependencies in bundler_bug_repro.gemspec
gemspec

Changing the version in the .gemspec file and running bundle install results in dependencies defined in the gemspec being unlocked and possibly bumped in the Gemfile.lock file.

What is your fix for the problem, implemented in this PR?

My fix is to accomodate the logic for finding the set of specs that need to be locked during resolution to do the right thing in this situation.

Fixes #6182.

Make sure the following tasks are checked

If the case of a gemspec changing for example its version number, there
was a comment about needing to unlock the gem. However, we were going
directly to process the next spec without unlock it, nor adding it to
the list of `converged` specs (which is what allows its dependencies to
be processed when finding the set of locked specs that should be passed
to the resolver).

This commit adds the spec to the `@unlock[:gems]` array explicitly, and
removes the `next` so that the logic to add it to the `converged` set
also applies here.
@deivid-rodriguez deivid-rodriguez changed the title Dont unlock dependencies of a gemspec when its version changes Don't unlock dependencies of a gemspec when its version changes Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bundle install in a gem project may unexpectedly update gem dependencies after changing your gem's version
2 participants