Fix bundler/inline
not resolving properly if gems not preinstalled
#6282
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was the end-user or developer problem that led to this PR?
After 2.4.4, some
bundler/inline
cases no longer work.What is your fix for the problem, implemented in this PR?
In inline mode, we resolve twice. First, we do a local resolution, and if that fails (local resolution failed, some resolved spec is not installed), we try again remotely.
Due to a recent refactoring, we were eagerly passing source requirements for resolution to a resolution context that would be reused for both of the above resolutions. However, the source requirements are different in the above two modes, so we need to make sure to calculate source requirements lazily when resolving.
However, that solution caused some issues with git sources, because it turns out during calculation of source requirements, we sort sources based on their
to_s
representation, and calling#to_s
on git sources actually causes side effects: the displayed revision is memoized in the source. That was causing git sources to no longer be updated correctly. I changed this sorting of sources to not rely on#to_s
to fix this derivated problem.Closes #6281.
Make sure the following tasks are checked