15 lines
362 B
Rust
15 lines
362 B
Rust
fn main() {
|
|
let mut hash = std::process::Command::new("git")
|
|
.args(&["rev-parse", "--short", "HEAD"])
|
|
.output()
|
|
.ok()
|
|
.and_then(|proc| String::from_utf8(proc.stdout).ok())
|
|
.unwrap_or_default();
|
|
|
|
if !hash.is_empty() {
|
|
hash = format!("-{}", hash);
|
|
}
|
|
|
|
println!("cargo:rustc-env=GIT_HASH={}", hash);
|
|
}
|