From 1e933bde6bb1bcf6f5cd58ff1b6c65eb7469e0c6 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Thu, 4 Feb 2021 23:34:14 +0800 Subject: [PATCH] fix: quick fix buildj --- Cargo.lock | 2 +- Cargo.toml | 2 +- build.rs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) 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();