mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-27 01:07:58 +00:00
fa0ad68279
- 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>
12 lines
422 B
Rust
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"),
|
|
};
|
|
}
|