fix the commit sha in the version (#129)

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
Cyrill Leutwiler
2024-12-03 12:34:17 +01:00
committed by GitHub
parent 0110258d81
commit 4e5482bad2
4 changed files with 83 additions and 7 deletions
+3
View File
@@ -48,6 +48,9 @@ mimalloc = { version = "*", default-features = false }
libc = { workspace = true }
inkwell = { workspace = true, features = ["target-riscv", "llvm18-0-no-llvm-linking"]}
[build-dependencies]
git2 = { workspace = true }
[features]
parallel = ["rayon"]
default = ["parallel"]
+5 -7
View File
@@ -1,9 +1,7 @@
fn main() {
let git_rev = std::process::Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.map(|out| String::from_utf8(out.stdout).unwrap_or_default())
.unwrap_or("unknown".to_owned());
println!("cargo:rustc-env=GIT_COMMIT_HASH={}", git_rev.trim());
let repo = git2::Repository::open("../..").expect("should be a repository");
let head = repo.head().expect("should have head");
let commit = head.peel_to_commit().expect("should have commit");
let id = &commit.id().to_string()[..7];
println!("cargo:rustc-env=GIT_COMMIT_HASH={id}");
}