diff --git a/crates/forge/bin/cmd/init.rs b/crates/forge/bin/cmd/init.rs index 784ebae3dc51..9dc1eea1ba83 100644 --- a/crates/forge/bin/cmd/init.rs +++ b/crates/forge/bin/cmd/init.rs @@ -84,7 +84,7 @@ impl InitArgs { git.submodule_init()?; } else { // if not shallow, initialize and clone submodules (without fetching latest) - git.submodule_update(false, false, true, true, None::)?; + git.submodule_update(false, false, true, true, std::iter::empty::())?; } } else { // if target is not empty diff --git a/crates/forge/bin/cmd/install.rs b/crates/forge/bin/cmd/install.rs index a990c4a91004..b7690d45845c 100644 --- a/crates/forge/bin/cmd/install.rs +++ b/crates/forge/bin/cmd/install.rs @@ -236,6 +236,15 @@ impl Installer<'_> { // checkout the tag if necessary self.git_checkout(&dep, path, false)?; + trace!("updating dependency submodules recursively"); + self.git.root(path).submodule_update( + false, + false, + false, + true, + std::iter::empty::(), + )?; + // remove git artifacts fs::remove_dir_all(path.join(".git"))?; @@ -259,6 +268,15 @@ impl Installer<'_> { // checkout the tag if necessary self.git_checkout(&dep, path, true)?; + trace!("updating dependency submodules recursively"); + self.git.root(path).submodule_update( + false, + false, + false, + true, + std::iter::empty::(), + )?; + if !self.no_commit { self.git.add(Some(path))?; } @@ -315,10 +333,7 @@ impl Installer<'_> { let path = path.strip_prefix(self.git.root).unwrap(); trace!(?dep, url, ?path, "installing git submodule"); - self.git.submodule_add(true, url, path)?; - - trace!("initializing submodule recursively"); - self.git.submodule_update(false, false, false, true, Some(path)) + self.git.submodule_add(true, url, path) } fn git_checkout(self, dep: &Dependency, path: &Path, recurse: bool) -> Result {