Skip to content

Commit d2a8b1a

Browse files
committed
rustbuild: Set ignore-git based on channel
This commit automatically sets `ignore-git` to `true` in configuration if the configured channel is set to "dev" and otherwise no value for `ignore-git` has been specified. This'll help rebuilds locally whenever a new commit is made by ensuring that git information never makes its way to compiler crates in the first place. Closes rust-lang#43771
1 parent 56fe3b2 commit d2a8b1a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/bootstrap/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct Info {
4444
impl GitInfo {
4545
pub fn new(config: &Config, dir: &Path) -> GitInfo {
4646
// See if this even begins to look like a git dir
47-
if config.ignore_git || !dir.join(".git").exists() {
47+
if config.ignore_git == Some(true) || !dir.join(".git").exists() {
4848
return GitInfo { inner: None }
4949
}
5050

src/bootstrap/config.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct Config {
5454
pub extended: bool,
5555
pub sanitizers: bool,
5656
pub profiler: bool,
57-
pub ignore_git: bool,
57+
pub ignore_git: Option<bool>,
5858

5959
pub run_host_only: bool,
6060

@@ -296,7 +296,6 @@ impl Config {
296296
config.rust_codegen_units = 1;
297297
config.channel = "dev".to_string();
298298
config.codegen_tests = true;
299-
config.ignore_git = false;
300299
config.rust_dist_src = true;
301300

302301
config.on_fail = flags.on_fail;
@@ -419,7 +418,7 @@ impl Config {
419418
set(&mut config.use_jemalloc, rust.use_jemalloc);
420419
set(&mut config.backtrace, rust.backtrace);
421420
set(&mut config.channel, rust.channel.clone());
422-
set(&mut config.ignore_git, rust.ignore_git);
421+
config.ignore_git = rust.ignore_git;
423422
config.rustc_default_linker = rust.default_linker.clone();
424423
config.rustc_default_ar = rust.default_ar.clone();
425424
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
@@ -478,6 +477,10 @@ impl Config {
478477
config.update_with_config_mk();
479478
}
480479

480+
if config.channel == "dev" && config.ignore_git.is_none() {
481+
config.ignore_git = Some(true);
482+
}
483+
481484
config
482485
}
483486

0 commit comments

Comments
 (0)