From 65e7c7a8176f97e61c642bc59b9838414d69df5c Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sun, 17 Aug 2025 14:58:18 -0400 Subject: [PATCH] docs: mention how Cargo fetch git submodules --- src/doc/src/reference/specifying-dependencies.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/doc/src/reference/specifying-dependencies.md b/src/doc/src/reference/specifying-dependencies.md index 9eb2c4679..1adfa6846 100644 --- a/src/doc/src/reference/specifying-dependencies.md +++ b/src/doc/src/reference/specifying-dependencies.md @@ -301,6 +301,20 @@ See [Multiple locations](#multiple-locations) section below for detailed explana > locations](#multiple-locations) section for a fallback alternative for `git` > and `path` dependencies. +### Git submodules + +When cloning a `git` dependency, +Cargo automatically fetches its submodules recursively +so that all required code is available for the build. + +To skip updates for a specific submodule, +Cargo respects the [`submodule..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. + +[`submodule..update`]: https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submodulenameupdate + ### Accessing private Git repositories See [Git Authentication](../appendix/git-authentication.md) for help with Git authentication for private repos.