Skip to content

Commit 8242ba9

Browse files
authored
Merge pull request #2653 from Xanewok/dont-rerun-on-git
Ignore checking inexistent .git/HEAD in build.rs
2 parents ac8ae00 + 01847fb commit 8242ba9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

build.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@
1111
use std::env;
1212
use std::fs::File;
1313
use std::io::Write;
14-
use std::path::PathBuf;
14+
use std::path::{Path, PathBuf};
1515
use std::process::Command;
1616

1717
fn main() {
18-
println!("cargo:rerun-if-changed=.git/HEAD");
18+
// Only check .git/HEAD dirty status if it exists - doing so when
19+
// building dependent crates may lead to false positives and rebuilds
20+
if Path::new(".git/HEAD").exists() {
21+
println!("cargo:rerun-if-changed=.git/HEAD");
22+
}
23+
1924
println!("cargo:rerun-if-env-changed=CFG_RELEASE_CHANNEL");
2025

2126
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());

0 commit comments

Comments
 (0)