From a0b0c57fa8919d52f63f14b924891f10a537af53 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Thu, 15 Feb 2024 22:44:34 +0400 Subject: [PATCH 1/3] fix(forge): update submodules after dependency checkout --- crates/forge/bin/cmd/install.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/forge/bin/cmd/install.rs b/crates/forge/bin/cmd/install.rs index a990c4a91004..9c81d91614d6 100644 --- a/crates/forge/bin/cmd/install.rs +++ b/crates/forge/bin/cmd/install.rs @@ -348,6 +348,10 @@ impl Installer<'_> { return Err(e) } + // We might have additional submodules after checkout, load them. + trace!("updating dependency submodules recursively"); + self.git.root(path).submodule_update(false, false, false, true, None::)?; + if is_branch { Ok(tag) } else { From 2f554209796a4d5ab4d234d983e12fd57467936d Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Thu, 15 Feb 2024 23:00:22 +0400 Subject: [PATCH 2/3] update submodules after checkout --- crates/forge/bin/cmd/install.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/forge/bin/cmd/install.rs b/crates/forge/bin/cmd/install.rs index 9c81d91614d6..1afcecb8d2bd 100644 --- a/crates/forge/bin/cmd/install.rs +++ b/crates/forge/bin/cmd/install.rs @@ -236,6 +236,9 @@ 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, None::)?; + // remove git artifacts fs::remove_dir_all(path.join(".git"))?; @@ -259,6 +262,9 @@ 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, None::)?; + if !self.no_commit { self.git.add(Some(path))?; } @@ -315,10 +321,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 { @@ -348,10 +351,6 @@ impl Installer<'_> { return Err(e) } - // We might have additional submodules after checkout, load them. - trace!("updating dependency submodules recursively"); - self.git.root(path).submodule_update(false, false, false, true, None::)?; - if is_branch { Ok(tag) } else { From f9b15a05da05583319e0f533ddd8fba52c173b5a Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Thu, 15 Feb 2024 23:34:41 +0400 Subject: [PATCH 3/3] std::iter::empty --- crates/forge/bin/cmd/init.rs | 2 +- crates/forge/bin/cmd/install.rs | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) 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 1afcecb8d2bd..b7690d45845c 100644 --- a/crates/forge/bin/cmd/install.rs +++ b/crates/forge/bin/cmd/install.rs @@ -237,7 +237,13 @@ impl Installer<'_> { self.git_checkout(&dep, path, false)?; trace!("updating dependency submodules recursively"); - self.git.root(path).submodule_update(false, false, false, true, None::)?; + self.git.root(path).submodule_update( + false, + false, + false, + true, + std::iter::empty::(), + )?; // remove git artifacts fs::remove_dir_all(path.join(".git"))?; @@ -263,7 +269,13 @@ impl Installer<'_> { self.git_checkout(&dep, path, true)?; trace!("updating dependency submodules recursively"); - self.git.root(path).submodule_update(false, false, false, true, None::)?; + self.git.root(path).submodule_update( + false, + false, + false, + true, + std::iter::empty::(), + )?; if !self.no_commit { self.git.add(Some(path))?;