From a4b539ac2ac8cea5ab4625baa64e8ab6773f7378 Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Fri, 11 Nov 2022 18:20:01 +0100 Subject: [PATCH] If syntax submodules don't exist at all, initialize them --- build.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.rs b/build.rs index 43f1e3e1f..c592b247c 100644 --- a/build.rs +++ b/build.rs @@ -191,6 +191,16 @@ fn compile_syntax(out_dir: &Path) -> Result<()> { parsing::{SyntaxDefinition, SyntaxSetBuilder}, }; + if std::fs::metadata("assets/syntaxes").is_err() { + let status = std::process::Command::new("git") + .args(["submodule", "update", "--init"]) + .status() + .context("attempting to initialize submodules")?; + if !status.success() { + return Err(anyhow::anyhow!("initializing submodules failed")); + } + } + fn tracked_add_from_folder( builder: &mut SyntaxSetBuilder, path: impl AsRef,