allow bffh to build outside of a git repo

This commit is contained in:
Kai Jan Kriegel 2022-03-16 05:42:56 +01:00 committed by Nadja Reitzenstein
parent 29a44bdb6a
commit ba005b3f9f

View File

@ -9,7 +9,10 @@ fn main() {
let owned_gitrev = String::from_utf8(out.stdout) let owned_gitrev = String::from_utf8(out.stdout)
.expect("git rev-list output was not valid UTF8"); .expect("git rev-list output was not valid UTF8");
let gitrev = owned_gitrev.trim(); let gitrev = owned_gitrev.trim();
let abbrev = &gitrev[0..9]; let abbrev = match gitrev.len(){
0 => "unknown",
_ => &gitrev[0..9],
};
println!("cargo:rustc-env=CARGO_PKG_VERSION_GITREV={}", gitrev); println!("cargo:rustc-env=CARGO_PKG_VERSION_GITREV={}", gitrev);
let out = Command::new("git").arg("log") let out = Command::new("git").arg("log")