Use git-describe rather than rev-parse
This commit is contained in:
parent
9469693763
commit
c43abf09d1
1 changed files with 3 additions and 3 deletions
6
build.rs
6
build.rs
|
@ -20,9 +20,9 @@
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
fn main() {
|
fn main() {
|
||||||
let profile = String::from(std::env::var("PROFILE").unwrap());
|
let profile = String::from(std::env::var("PROFILE").unwrap());
|
||||||
let git_hash = if profile == "debug" {
|
let git_version = if profile == "debug" {
|
||||||
let output = Command::new("git")
|
let output = Command::new("git")
|
||||||
.args(&["rev-parse", "--short=10", "HEAD"])
|
.args(&["describe", "HEAD"])
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
String::from_utf8(output.stdout).unwrap()
|
String::from_utf8(output.stdout).unwrap()
|
||||||
|
@ -30,5 +30,5 @@ fn main() {
|
||||||
String::from("")
|
String::from("")
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("cargo:rustc-env=CARGO_BUILD_GIT_HASH={}", git_hash);
|
println!("cargo:rustc-env=CARGO_BUILD_VERSION={}", git_version);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue