build.rs: tell cargo to only rerun build.rs step if .git/HEAD changes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
847c27fbee
commit
61a758f67d
2
build.rs
2
build.rs
|
@ -12,10 +12,12 @@ fn git_command(args: &[&str]) -> String {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let repo_path = git_command(&["rev-parse", "--show-toplevel"]);
|
||||
let repoid = match env::var("REPOID") {
|
||||
Ok(repoid) => repoid,
|
||||
Err(_) => git_command(&["rev-parse", "HEAD"]),
|
||||
};
|
||||
|
||||
println!("cargo:rustc-env=REPOID={}", repoid);
|
||||
println!("cargo:rerun-if-changed={}/.git/HEAD", repo_path);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue