@@ -2873,21 +2873,26 @@ impl Config { |
|
|
2873 |
2873 |
allowed_paths.push(":!library"); |
2874 |
2874 |
} |
2875 |
2875 |
|
2876 |
|
-// Look for a version to compare to based on the current commit. |
2877 |
|
-// Only commits merged by bors will have CI artifacts. |
2878 |
|
-let commit = match self.last_modified_commit(&allowed_paths, "download-rustc", if_unchanged) |
2879 |
|
-{ |
2880 |
|
-Some(commit) => commit, |
2881 |
|
-None => { |
2882 |
|
-if if_unchanged { |
2883 |
|
-return None; |
|
2876 |
+let commit = if self.rust_info.is_managed_git_subrepository() { |
|
2877 |
+// Look for a version to compare to based on the current commit. |
|
2878 |
+// Only commits merged by bors will have CI artifacts. |
|
2879 |
+match self.last_modified_commit(&allowed_paths, "download-rustc", if_unchanged) { |
|
2880 |
+Some(commit) => commit, |
|
2881 |
+None => { |
|
2882 |
+if if_unchanged { |
|
2883 |
+return None; |
|
2884 |
+} |
|
2885 |
+println!("ERROR: could not find commit hash for downloading rustc"); |
|
2886 |
+println!("HELP: maybe your repository history is too shallow?"); |
|
2887 |
+println!("HELP: consider setting `rust.download-rustc=false` in config.toml"); |
|
2888 |
+println!("HELP: or fetch enough history to include one upstream commit"); |
|
2889 |
+crate::exit!(1); |
2884 |
2890 |
} |
2885 |
|
-println!("ERROR: could not find commit hash for downloading rustc"); |
2886 |
|
-println!("HELP: maybe your repository history is too shallow?"); |
2887 |
|
-println!("HELP: consider setting `rust.download-rustc=false` in config.toml"); |
2888 |
|
-println!("HELP: or fetch enough history to include one upstream commit"); |
2889 |
|
-crate::exit!(1); |
2890 |
2891 |
} |
|
2892 |
+} else { |
|
2893 |
+ channel::read_commit_info_file(&self.src) |
|
2894 |
+.map(|info |
|
2895 |
+.expect("git-commit-info is missing in the project root") |
2891 |
2896 |
}; |
2892 |
2897 |
|
2893 |
2898 |
if CiEnv::is_ci() && { |
@@ -2969,6 +2974,11 @@ impl Config { |
|
|
2969 |
2974 |
option_name: &str, |
2970 |
2975 |
if_unchanged: bool, |
2971 |
2976 |
) -> Option<String> { |
|
2977 |
+assert!( |
|
2978 |
+self.rust_info.is_managed_git_subrepository(), |
|
2979 |
+"Can't run `Config::last_modified_commit` on a non-git source." |
|
2980 |
+); |
|
2981 |
+ |
2972 |
2982 |
// Look for a version to compare to based on the current commit. |
2973 |
2983 |
// Only commits merged by bors will have CI artifacts. |
2974 |
2984 |
let commit = get_closest_merge_commit(Some(&self.src), &self.git_config(), &[]).unwrap(); |