Files
revive/crates/resolc/build.rs
T
xermicus fa0ad68279 make resolc crate publishable (#334)
- Fetching the commit SHA must not panic if not executed in a git
repository.
- Remove the license printer.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
2025-05-27 14:13:12 +02:00

12 lines
422 B
Rust

fn main() {
match git2::Repository::open("../..") {
Ok(repo) => {
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}");
}
Err(_) => println!("cargo:rustc-env=GIT_COMMIT_HASH=unknown"),
};
}