diff --git a/atuin/build.rs b/atuin/build.rs index 06df646..f24cf1b 100644 --- a/atuin/build.rs +++ b/atuin/build.rs @@ -1,10 +1,11 @@ use std::process::Command; fn main() { - let output = Command::new("git") - .args(["rev-parse", "HEAD"]) - .output() - .unwrap(); + let output = Command::new("git").args(["rev-parse", "HEAD"]).output(); - let git_hash = String::from_utf8(output.stdout).unwrap(); - println!("cargo:rustc-env=GIT_HASH={}", git_hash); + let sha = match output { + Ok(sha) => String::from_utf8(sha.stdout).unwrap(), + Err(_) => String::from("NO_GIT"), + }; + + println!("cargo:rustc-env=GIT_HASH={}", sha); }