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

fix: fetch nested git submodules #12244

Merged
merged 7 commits into from
Jun 8, 2023

Conversation

chris-crespo
Copy link
Contributor

@chris-crespo chris-crespo commented Jun 8, 2023

What does this PR try to resolve?

Fixes #12151.

When recursing submodules, the url of the parent remote was being passed to update_submodules instead of the child remote url. This caused Cargo to try to add the wrong submodule.

How should we test and review this PR?

A test case is added in the first commit. The second one renames the url variable as suggested in the issue. The third includes the changes to fix the issue. The last one includes a minor refactor where a redundant match expr is removed.

@rustbot
Copy link
Collaborator

rustbot commented Jun 8, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @weihanglo (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added A-git Area: anything dealing with git S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 8, 2023
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for filing a patch so fast! Looks pretty good to me :)

src/cargo/sources/git/utils.rs Outdated Show resolved Hide resolved
src/cargo/sources/git/utils.rs Outdated Show resolved Hide resolved
tests/testsuite/git.rs Outdated Show resolved Hide resolved
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. That's pretty much of it!

@weihanglo
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 8, 2023

📌 Commit 56318e0 has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 8, 2023
@bors
Copy link
Contributor

bors commented Jun 8, 2023

⌛ Testing commit 56318e0 with merge c33d6d2...

@weihanglo
Copy link
Member

@bors r-

bors added a commit that referenced this pull request Jun 8, 2023
fix: git submodules with relative urls

### What does this PR try to resolve?

Fixes #12151.

When recursing submodules, the url of the parent remote was being passed to `update_submodules` instead of the child remote url. This caused Cargo to try to add the wrong submodule.

### How should we test and review this PR?

A test case is added in the first commit. The second one renames the `url` variable as suggested in the issue. The third includes the changes to fix the issue. The last one includes a minor refactor where a redundant `match` expr is removed.
@bors bors added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 8, 2023
@weihanglo weihanglo changed the title fix: git submodules with relative urls fix: fetch nested git submodules Jun 8, 2023
@weihanglo
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 8, 2023

📌 Commit 56318e0 has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. labels Jun 8, 2023
@bors
Copy link
Contributor

bors commented Jun 8, 2023

⌛ Testing commit 56318e0 with merge 173b88b...

@bors
Copy link
Contributor

bors commented Jun 8, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 173b88b to master...

1 similar comment
@bors
Copy link
Contributor

bors commented Jun 8, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 173b88b to master...

@bors
Copy link
Contributor

bors commented Jun 8, 2023

👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request.

@bors bors merged commit 173b88b into rust-lang:master Jun 8, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 10, 2023
Update cargo

12 commits in b0fa79679e717cd077b7fc0fa4166f47107f1ba9..49b6d9e179a91cf7645142541c9563443f64bf2b
2023-06-03 14:19:48 +0000 to 2023-06-09 17:21:19 +0000
- docs: doc comments for all registry kinds (rust-lang/cargo#12247)
- chore: Migrate print-ban from test to clippy (rust-lang/cargo#12246)
- fix: fetch nested git submodules (rust-lang/cargo#12244)
- refactor: registry source cleanup (rust-lang/cargo#12240)
- test: loose overly matches for git cli output (rust-lang/cargo#12241)
- fix: disable multiplexing on macOS for some versions of curl (rust-lang/cargo#12234)
- docs: doc comments for registry source and index (rust-lang/cargo#12239)
- doc: point to nightly cargo doc (rust-lang/cargo#12237)
- Upgrade to `gix` v0.45 for multi-round pack negotiations. (rust-lang/cargo#12236)
- refactor: git source cleanup (rust-lang/cargo#12197)
- Add message on reusing previous temporary path on failed cargo installs (rust-lang/cargo#12231)
- doc: the first line should be a simple sentence instead of a heading (rust-lang/cargo#12228)

r? `@ghost`
@ehuss ehuss added this to the 1.72.0 milestone Jun 22, 2023
weihanglo added a commit to weihanglo/cargo that referenced this pull request Jul 14, 2023
`parent_remote_url` used to be `&str` before rust-lang#12244. However, we changed
the type to `Url` and it started failing to parse scp-like URLs since
they are not compliant with WHATWG URL spec.

In this commit, we change it back to `&str` and construct the URL
manually. This should be safe since Cargo already checks if it is a
relative URL for that if branch.
weihanglo added a commit to weihanglo/cargo that referenced this pull request Jul 15, 2023
`parent_remote_url` used to be `&str` before rust-lang#12244. However, we changed
the type to `Url` and it started failing to parse scp-like URLs since
they are not compliant with WHATWG URL spec.

In this commit, we change it back to `&str` and construct the URL
manually. This should be safe since Cargo already checks if it is a
relative URL for that if branch.
weihanglo added a commit to weihanglo/cargo that referenced this pull request Jul 18, 2023
`parent_remote_url` used to be `&str` before rust-lang#12244. However, we changed
the type to `Url` and it started failing to parse scp-like URLs since
they are not compliant with WHATWG URL spec.

In this commit, we change it back to `&str` and construct the URL
manually. This should be safe since Cargo already checks if it is a
relative URL for that if branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relative git submodules did not resolve correctly
5 participants