From ad61faaecfdb29b9ec9226c194ea2731e256ac9a Mon Sep 17 00:00:00 2001 From: southerntofu Date: Sun, 9 Jan 2022 15:59:27 +0100 Subject: [PATCH] Make sure submodules added after first clone are initialized properly --- src/dvcs.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/dvcs.rs b/src/dvcs.rs index 76ffc90..0dd5fe4 100644 --- a/src/dvcs.rs +++ b/src/dvcs.rs @@ -233,7 +233,19 @@ impl Repo { .expect("WTF") .success() { - // Main updates succeeded + // Main updates succeeded. If new submodules were added, initialize them + if !Command::new("git") + .arg("submodule") + .arg("update") + .arg("--init") + .arg("--recursive") + .status() + .expect("WTF") + .success() + { + // TODO: Should be forgebuild error message + eprintln!("Failed to initialize submodules which were added to the repo"); + } return true; } else { // Main updates failed, return true if there were some submodule updates