Skip to content

Commit 8c39575

Browse files
committed
Fix build metadata rerun tracking
1 parent a8a437a commit 8c39575

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
fn main() {
2+
println!("cargo:rerun-if-changed=.git/HEAD");
3+
println!("cargo:rerun-if-changed=.git/packed-refs");
4+
5+
if let Ok(head) = std::fs::read_to_string(".git/HEAD") {
6+
if let Some(ref_name) = head.strip_prefix("ref: ") {
7+
println!("cargo:rerun-if-changed=.git/{}", ref_name.trim());
8+
}
9+
}
10+
211
let git_hash = std::process::Command::new("git")
312
.args(["rev-parse", "--short", "HEAD"])
413
.output()

0 commit comments

Comments
 (0)