From 05c3cca365735f055ee0c7582335f065324b4324 Mon Sep 17 00:00:00 2001 From: Matthew Esposito Date: Wed, 4 Jan 2023 16:31:27 -0500 Subject: [PATCH] Non-git fallback --- build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 2a91e1e..818a55f 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,6 @@ use std::process::Command; fn main() { - let output = Command::new("git").args(["rev-parse", "HEAD"]).output().unwrap(); - let git_hash = String::from_utf8(output.stdout).unwrap(); + let output = String::from_utf8(Command::new("git").args(["rev-parse", "HEAD"]).output().unwrap().stdout).unwrap_or_default(); + let git_hash = if output == String::default() { "dev".into() } else { output }; println!("cargo:rustc-env=GIT_HASH={git_hash}"); }