Skip to content

Commit 9c3f143

Browse files
Rollup merge of rust-lang#117868 - ferrocene:pa-omit-git-hash, r=Mark-Simulacrum
Set `CFG_OMIT_GIT_HASH=1` during builds when `omit-git-hash` is enabled This environment variable will allow tools like Cargo to disable their own detection when `omit-git-hash` is set to `true`. I created this PR because of rust-lang/cargo#12968. There is not a dependency between the two PRs, they can land in any order. They just won't do anything until both of them are merged into the repo.
2 parents cec7f6f + cd4adb8 commit 9c3f143

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/bootstrap/src/core/build_steps/compile.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,13 @@ pub fn rustc_cargo_env(
10051005
.env("CFG_RELEASE_CHANNEL", &builder.config.channel)
10061006
.env("CFG_VERSION", builder.rust_version());
10071007

1008+
// Some tools like Cargo detect their own git information in build scripts. When omit-git-hash
1009+
// is enabled in config.toml, we pass this environment variable to tell build scripts to avoid
1010+
// detecting git information on their own.
1011+
if builder.config.omit_git_hash {
1012+
cargo.env("CFG_OMIT_GIT_HASH", "1");
1013+
}
1014+
10081015
if let Some(backend) = builder.config.default_codegen_backend() {
10091016
cargo.env("CFG_DEFAULT_CODEGEN_BACKEND", backend);
10101017
}

0 commit comments

Comments
 (0)