diff --git a/crates/cli/src/utils/mod.rs b/crates/cli/src/utils/mod.rs index 30c984c960f14..68cb49a6891fd 100644 --- a/crates/cli/src/utils/mod.rs +++ b/crates/cli/src/utils/mod.rs @@ -575,6 +575,10 @@ ignore them in the `.gitignore` file." self.cmd().stderr(self.stderr()).args(["submodule", "init"]).exec().map(drop) } + pub fn submodule_sync(self) -> Result<()> { + self.cmd().stderr(self.stderr()).args(["submodule", "sync"]).exec().map(drop) + } + pub fn cmd(self) -> Command { let mut cmd = Self::cmd_no_root(); cmd.current_dir(self.root); diff --git a/crates/forge/src/cmd/install.rs b/crates/forge/src/cmd/install.rs index 7672787ce26f6..0a88c6eca7ab1 100644 --- a/crates/forge/src/cmd/install.rs +++ b/crates/forge/src/cmd/install.rs @@ -276,6 +276,9 @@ impl Installer<'_> { std::iter::empty::(), )?; + // sync submodules config with changes in .gitmodules, see + self.git.root(path).submodule_sync()?; + if self.commit { self.git.add(Some(path))?; }