Skip to content

Commit

Permalink
don't return suggestion message if no changes detected
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Dec 29, 2023
1 parent e013378 commit 27c97d5
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,25 +158,27 @@ fn check_version(config: &Config) -> Option<String> {

let changes = find_recent_config_change_ids(id);

if !changes.is_empty() {
msg.push_str("There have been changes to x.py since you last updated:\n");

for change in changes {
msg.push_str(&format!(" [{}] {}\n", change.severity.to_string(), change.summary));
msg.push_str(&format!(
" - PR Link https://github.com/rust-lang/rust/pull/{}\n",
change.change_id
));
}
if changes.is_empty() {
return None;
}

msg.push_str("There have been changes to x.py since you last updated:\n");

msg.push_str("NOTE: to silence this warning, ");
for change in changes {
msg.push_str(&format!(" [{}] {}\n", change.severity.to_string(), change.summary));
msg.push_str(&format!(
"update `config.toml` to use `change-id = {latest_change_id}` instead"
" - PR Link https://github.com/rust-lang/rust/pull/{}\n",
change.change_id
));
}

if io::stdout().is_terminal() && !config.dry_run() {
t!(fs::write(warned_id_path, latest_change_id.to_string()));
}
msg.push_str("NOTE: to silence this warning, ");
msg.push_str(&format!(
"update `config.toml` to use `change-id = {latest_change_id}` instead"
));

if io::stdout().is_terminal() && !config.dry_run() {
t!(fs::write(warned_id_path, latest_change_id.to_string()));
}
} else {
msg.push_str("WARNING: The `change-id` is missing in the `config.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.\n");
Expand Down

0 comments on commit 27c97d5

Please sign in to comment.