diff --git a/Cargo.lock b/Cargo.lock index f1b7f5a..0282664 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -87,7 +87,7 @@ dependencies = [ [[package]] name = "buildj" -version = "0.1.5" +version = "0.1.6" dependencies = [ "dirs 3.0.1", "json", diff --git a/Cargo.toml b/Cargo.toml index db1639d..44340c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "buildj" -version = "0.1.5" +version = "0.1.6" authors = ["Hatter Jiang "] edition = "2018" homepage = "https://buildj.ruststack.org/" diff --git a/build.rs b/build.rs index 561c0de..aba10c2 100644 --- a/build.rs +++ b/build.rs @@ -2,7 +2,10 @@ 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 mut git_hash = String::from_utf8(output.stdout).unwrap(); + if git_hash.is_empty() { + git_hash = "0000000000000000000000000000000000000000".to_string(); + } println!("cargo:rustc-env=GIT_HASH={}", git_hash); let date_output = Command::new("date").args(&["+%Y-%m-%dT%H:%M:%S%z"]).output().unwrap(); let date = String::from_utf8(date_output.stdout).unwrap();