Skip to content

docs: mention how Cargo fetch git submodules #15853

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

Merged
merged 1 commit into from
Aug 18, 2025

Conversation

weihanglo
Copy link
Member

What does this PR try to resolve?

Clarify how git submodules are handled in Cargo for git dependencies.

See #4247 (comment)

@weihanglo weihanglo added the A-git Area: anything dealing with git label Aug 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 17, 2025

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 17, 2025
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

@ehuss ehuss added this pull request to the merge queue Aug 18, 2025
Comment on lines +310 to +314
To skip updates for a specific submodule,
Cargo respects the [`submodule.<name>.update`] setting in `.gitmodules`.
Setting it to `none` disables updates for that submodule if it isn't needed for the build.
This is usually set in the repository itself,
so changes require access to the dependency's repo.
Copy link
Contributor

Choose a reason for hiding this comment

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

The first paragraph talks in terms of behavior (fetch) while the second paragraph talks in terms of a git submodule specific term (update) that I worry may confuse users.

What do you think of:

Suggested change
To skip updates for a specific submodule,
Cargo respects the [`submodule.<name>.update`] setting in `.gitmodules`.
Setting it to `none` disables updates for that submodule if it isn't needed for the build.
This is usually set in the repository itself,
so changes require access to the dependency's repo.
To skip fetching submodules unrelated to the build, you can set [`submodule.<name>.update = none`] in the dependency repo's `.gitmodules`.
This requires write access to the repo and will disable submodule updates more generally.

Copy link
Member Author

Choose a reason for hiding this comment

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

This seems a bit more concise and understandable!

Merged via the queue into rust-lang:master with commit 62537dd Aug 18, 2025
23 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 18, 2025
@weihanglo weihanglo deleted the git-submodules branch August 18, 2025 15:53
github-merge-queue bot pushed a commit that referenced this pull request Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation A-git Area: anything dealing with git
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants