Skip to content

Commit cd4adb8

Browse files
committed
set CFG_OMIT_GIT_HASH=1 during builds when omit-git-hash is enabled
1 parent 6eb3e97 commit cd4adb8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/bootstrap/src/core/build_steps/compile.rs

+7
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,13 @@ pub fn rustc_cargo_env(
975975
.env("CFG_RELEASE_CHANNEL", &builder.config.channel)
976976
.env("CFG_VERSION", builder.rust_version());
977977

978+
// Some tools like Cargo detect their own git information in build scripts. When omit-git-hash
979+
// is enabled in config.toml, we pass this environment variable to tell build scripts to avoid
980+
// detecting git information on their own.
981+
if builder.config.omit_git_hash {
982+
cargo.env("CFG_OMIT_GIT_HASH", "1");
983+
}
984+
978985
if let Some(backend) = builder.config.default_codegen_backend() {
979986
cargo.env("CFG_DEFAULT_CODEGEN_BACKEND", backend);
980987
}

0 commit comments

Comments
 (0)