Skip to content

Commit

Permalink
rustbuild: Set ignore-git based on channel
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alexcrichton committed Aug 15, 2017
1 parent 56fe3b2 commit d2a8b1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct Info {
impl GitInfo {
pub fn new(config: &Config, dir: &Path) -> GitInfo {
// See if this even begins to look like a git dir
if config.ignore_git || !dir.join(".git").exists() {
if config.ignore_git == Some(true) || !dir.join(".git").exists() {
return GitInfo { inner: None }
}

Expand Down
9 changes: 6 additions & 3 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct Config {
pub extended: bool,
pub sanitizers: bool,
pub profiler: bool,
pub ignore_git: bool,
pub ignore_git: Option<bool>,

pub run_host_only: bool,

Expand Down Expand Up @@ -296,7 +296,6 @@ impl Config {
config.rust_codegen_units = 1;
config.channel = "dev".to_string();
config.codegen_tests = true;
config.ignore_git = false;
config.rust_dist_src = true;

config.on_fail = flags.on_fail;
Expand Down Expand Up @@ -419,7 +418,7 @@ impl Config {
set(&mut config.use_jemalloc, rust.use_jemalloc);
set(&mut config.backtrace, rust.backtrace);
set(&mut config.channel, rust.channel.clone());
set(&mut config.ignore_git, rust.ignore_git);
config.ignore_git = rust.ignore_git;
config.rustc_default_linker = rust.default_linker.clone();
config.rustc_default_ar = rust.default_ar.clone();
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
Expand Down Expand Up @@ -478,6 +477,10 @@ impl Config {
config.update_with_config_mk();
}

if config.channel == "dev" && config.ignore_git.is_none() {
config.ignore_git = Some(true);
}

config
}

Expand Down

0 comments on commit d2a8b1a

Please sign in to comment.