Skip to content

Commit 45f573a

Browse files
committed
simplyfied download_ci_rustc_commit
1 parent 843d709 commit 45f573a

File tree

1 file changed

+6
-38
lines changed

1 file changed

+6
-38
lines changed

src/bootstrap/src/core/config/config.rs

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,24 +2755,16 @@ impl Config {
27552755
};
27562756

27572757
let files_to_track = &[
2758-
self.src.join("compiler"),
2759-
self.src.join("library"),
2760-
self.src.join("src/version"),
2761-
self.src.join("src/stage0"),
2762-
self.src.join("src/ci/channel"),
2758+
"compiler",
2759+
"library",
2760+
"src/version",
2761+
"src/stage0",
2762+
"src/ci/channel",
27632763
];
27642764

27652765
// Look for a version to compare to based on the current commit.
27662766
// Only commits merged by bors will have CI artifacts.
2767-
let commit =
2768-
get_closest_merge_commit(Some(&self.src), &self.git_config(), files_to_track).unwrap();
2769-
if commit.is_empty() {
2770-
println!("ERROR: could not find commit hash for downloading rustc");
2771-
println!("HELP: maybe your repository history is too shallow?");
2772-
println!("HELP: consider disabling `download-rustc`");
2773-
println!("HELP: or fetch enough history to include one upstream commit");
2774-
crate::exit!(1);
2775-
}
2767+
let commit = self.last_modified_commit(files_to_track, "download-rustc", if_unchanged).unwrap();
27762768

27772769
if CiEnv::is_ci() && {
27782770
let head_sha =
@@ -2787,30 +2779,6 @@ impl Config {
27872779
return None;
27882780
}
27892781

2790-
// Warn if there were changes to the compiler or standard library since the ancestor commit.
2791-
let has_changes = !t!(helpers::git(Some(&self.src))
2792-
.args(["diff-index", "--quiet", &commit])
2793-
.arg("--")
2794-
.args(files_to_track)
2795-
.as_command_mut()
2796-
.status())
2797-
.success();
2798-
if has_changes {
2799-
if if_unchanged {
2800-
if self.is_verbose() {
2801-
println!(
2802-
"WARNING: saw changes to compiler/ or library/ since {commit}; \
2803-
ignoring `download-rustc`"
2804-
);
2805-
}
2806-
return None;
2807-
}
2808-
println!(
2809-
"WARNING: `download-rustc` is enabled, but there are changes to \
2810-
compiler/ or library/"
2811-
);
2812-
}
2813-
28142782
Some(commit.to_string())
28152783
}
28162784

0 commit comments

Comments
 (0)