Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
// Supply information as compile-time environment variables.
#[cfg(feature = "opa-runtime")]
{
let output = std::process::Command::new("git")
let git_hash = std::process::Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.expect("`git rev-parse HEAD` failed.");
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={git_hash}");
.map(|output| String::from_utf8_lossy(&output.stdout).trim().to_string())
.unwrap_or_else(|_| "unknown".to_string());
println!("cargo:rustc-env=GIT_HASH={}", git_hash);

Check warning

Code scanning / clippy

variables can be used directly in the format! string Warning

variables can be used directly in the format! string
}

// Rerun only if build.rs changes.
Expand Down
Loading