runtime: use proper format for git commit.

Fixes #620.
This commit is contained in:
whitequark 2016-11-17 15:20:21 +00:00
parent 18c394976e
commit c7844d5223
1 changed files with 4 additions and 2 deletions

View File

@ -13,8 +13,10 @@ fn main() {
let dest_path = Path::new(&out_dir).join("git_info.rs"); let dest_path = Path::new(&out_dir).join("git_info.rs");
let mut f = File::create(&dest_path).unwrap(); let mut f = File::create(&dest_path).unwrap();
writeln!(f, "const GIT_COMMIT: &'static str = {:?};", let id = git_describe().unwrap();
git_describe().unwrap()).unwrap(); let id = id.split("-").collect::<Vec<_>>();
let id = format!("{}+{}.{}", id[0], id[1], id[2]);
writeln!(f, "const GIT_COMMIT: &'static str = {:?};", id).unwrap();
println!("cargo:rerun-if-changed=../../.git/HEAD"); println!("cargo:rerun-if-changed=../../.git/HEAD");
for entry in WalkDir::new("../../.git/refs") { for entry in WalkDir::new("../../.git/refs") {