@@ -2726,17 +2726,25 @@ impl Config {
2726
2726
}
2727
2727
2728
2728
let dirs = vec ! [ PathBuf :: from( "compiler" ) , PathBuf :: from( "library" ) ] ;
2729
- match self . check_for_changes ( & dirs, & commit, "download-rustc" , if_unchanged) {
2730
- Some ( true ) => {
2731
- println ! (
2732
- "WARNING: `download-rustc` is enabled, but there are changes to \
2733
- compiler/ or library/"
2734
- ) ;
2735
- Some ( commit. to_string ( ) )
2729
+ let has_changes = self . check_for_changes ( & dirs, & commit) ;
2730
+
2731
+ if has_changes {
2732
+ if if_unchanged {
2733
+ if self . is_verbose ( ) {
2734
+ println ! (
2735
+ "WARNING: saw changes to compiler/ or library/ since {commit}; \
2736
+ ignoring `download-rustc`"
2737
+ ) ;
2738
+ }
2739
+ return None ;
2736
2740
}
2737
- Some ( false ) => Some ( commit. to_string ( ) ) ,
2738
- None => None ,
2741
+ println ! (
2742
+ "WARNING: `download-rustc` is enabled, but there are changes to \
2743
+ compiler/ or library/"
2744
+ ) ;
2739
2745
}
2746
+
2747
+ Some ( commit. to_string ( ) )
2740
2748
}
2741
2749
2742
2750
fn parse_download_ci_llvm (
@@ -2836,42 +2844,17 @@ impl Config {
2836
2844
}
2837
2845
2838
2846
/// Check for changes in specified directories since a given commit.
2839
- /// Returns Some(true) if changes exist, Some(false) if no changes, None if check should be ignored.
2840
- pub fn check_for_changes (
2841
- & self ,
2842
- dirs : & [ PathBuf ] ,
2843
- commit : & str ,
2844
- option_name : & str ,
2845
- if_unchanged : bool ,
2846
- ) -> Option < bool > {
2847
+ /// Returns true if changes exist, false if no changes
2848
+ pub fn check_for_changes ( & self , dirs : & [ PathBuf ] , commit : & str ) -> bool {
2847
2849
let mut git = helpers:: git ( Some ( & self . src ) ) ;
2848
2850
git. args ( [ "diff-index" , "--quiet" , commit] ) ;
2849
-
2850
2851
if !dirs. is_empty ( ) {
2851
2852
git. arg ( "--" ) ;
2852
2853
for dir in dirs {
2853
2854
git. arg ( self . src . join ( dir) ) ;
2854
2855
}
2855
2856
}
2856
-
2857
- let has_changes = !t ! ( git. as_command_mut( ) . status( ) ) . success ( ) ;
2858
-
2859
- if has_changes {
2860
- if if_unchanged {
2861
- if self . is_verbose ( ) {
2862
- println ! (
2863
- "WARNING: saw changes to one of {:?} since {}; \
2864
- ignoring `{}`",
2865
- dirs, commit, option_name
2866
- ) ;
2867
- }
2868
- None
2869
- } else {
2870
- Some ( true )
2871
- }
2872
- } else {
2873
- Some ( false )
2874
- }
2857
+ !t ! ( git. as_command_mut( ) . status( ) ) . success ( )
2875
2858
}
2876
2859
}
2877
2860
0 commit comments