File tree 2 files changed +20
-16
lines changed
2 files changed +20
-16
lines changed Original file line number Diff line number Diff line change 1
1
use std:: path:: PathBuf ;
2
2
use std:: { env, fs} ;
3
3
4
- use build_helper:: git:: get_closest_merge_commit;
5
-
6
4
use crate :: core:: build_steps:: compile;
7
5
use crate :: core:: build_steps:: toolstate:: ToolState ;
8
6
use crate :: core:: builder;
@@ -596,19 +594,14 @@ impl Step for Rustdoc {
596
594
&& target_compiler. stage > 0
597
595
&& builder. rust_info ( ) . is_managed_git_subrepository ( )
598
596
{
599
- let commit = get_closest_merge_commit (
600
- Some ( & builder. config . src ) ,
601
- & builder. config . git_config ( ) ,
602
- & [ ] ,
603
- )
604
- . unwrap ( ) ;
605
597
606
- let dirs = vec ! [
607
- builder . config . src . join ( "src/librustdoc" ) ,
608
- builder . config . src . join ( "src/tools/rustdoc" ) ,
598
+ let files_to_track = & [
599
+ "src/librustdoc" ,
600
+ "src/tools/rustdoc" ,
609
601
] ;
610
- let has_changes = builder. config . check_for_changes ( & dirs, & commit) ;
611
- if !has_changes {
602
+
603
+ if builder. config . last_modified_commit ( files_to_track, "rustdoc" , true ) . is_some ( ) {
604
+ // if return Some(commit),means unchanged
612
605
let precompiled_rustdoc = builder
613
606
. config
614
607
. ci_rustc_dir ( )
Original file line number Diff line number Diff line change @@ -2759,8 +2759,19 @@ impl Config {
2759
2759
2760
2760
// Look for a version to compare to based on the current commit.
2761
2761
// Only commits merged by bors will have CI artifacts.
2762
- let commit =
2763
- self . last_modified_commit ( files_to_track, "download-rustc" , if_unchanged) . unwrap ( ) ;
2762
+ let commit = match self . last_modified_commit ( files_to_track, "download-rustc" , if_unchanged) {
2763
+ Some ( commit) => commit,
2764
+ None => {
2765
+ if if_unchanged{
2766
+ return None ;
2767
+ }
2768
+ println ! ( "ERROR: could not find commit hash for downloading rustc" ) ;
2769
+ println ! ( "HELP: maybe your repository history is too shallow?" ) ;
2770
+ println ! ( "HELP: consider disabling `download-rustc`" ) ;
2771
+ println ! ( "HELP: or fetch enough history to include one upstream commit" ) ;
2772
+ crate :: exit!( 1 ) ;
2773
+ }
2774
+ } ;
2764
2775
2765
2776
if CiEnv :: is_ci ( ) && {
2766
2777
let head_sha =
@@ -2775,7 +2786,7 @@ impl Config {
2775
2786
return None ;
2776
2787
}
2777
2788
2778
- Some ( commit. to_string ( ) )
2789
+ Some ( commit)
2779
2790
}
2780
2791
2781
2792
fn parse_download_ci_llvm (
You can’t perform that action at this time.
0 commit comments