use std::process::Command;
fn main() {
// Get git commit hash (only available when building from a git checkout)
let output = Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output();
let commit = match output {
Ok(output) if output.status.success() => {
String::from_utf8_lossy(&output.stdout).trim().to_string()
}
// No git repo (e.g., crates.io install) - leave empty to show just version
_ => String::new(),
};
println!("cargo::rustc-env=MI6_GIT_COMMIT={}", commit);
// Re-run if git HEAD changes
println!("cargo::rerun-if-changed=.git/HEAD");
println!("cargo::rerun-if-changed=.git/refs/heads/");
}