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

Ensure absolute lockfile remotes for gems nested inside project #2799

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

vinistock
Copy link
Member

Motivation

I discovered this problem while working on #2774 and I frankly don't understand how it wasn't surfaced before.

We were checking for a leading dot to perform remote relative path correction, but when you have gems nested inside a project, the relative path may not necessarily begin with a dot.

For example, if you have this in your Gemfile

gem "nested", path: "gems/nested"

Then the remote won't necessarily be ../gems/nested. It might just be gems/nested, which is also a relative path. We need to convert those into absolute paths too, otherwise setting up the composed bundle fails.

Implementation

I started using URI to check if the remote has a scheme. If it has a scheme, like http, then we don't want to perform any corrections.

If it has no scheme, then it's a file path and we can turn it into absolute.

Automated Tests

Added a test that doesn't pass before the fix.

@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Oct 29, 2024
@vinistock vinistock self-assigned this Oct 29, 2024
@vinistock vinistock requested a review from a team as a code owner October 29, 2024 14:44
@vinistock vinistock requested review from andyw8 and st0012 October 29, 2024 14:44
@vinistock vinistock merged commit eadd431 into main Oct 29, 2024
36 of 37 checks passed
@vinistock vinistock deleted the vs-ensure-absolute-remotes-for-nested-gems branch October 29, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants