@@ -2421,7 +2421,7 @@ impl Config {
2421
2421
2422
2422
let disable_ci_rustc_if_incompatible =
2423
2423
env:: var_os ( "DISABLE_CI_RUSTC_IF_INCOMPATIBLE" )
2424
- . is_some_and ( |s| s == "1" || s == "true" ) ;
2424
+ . is_some_and ( |s| s == "1" || s == "true" ) ;
2425
2425
2426
2426
if disable_ci_rustc_if_incompatible && res. is_err ( ) {
2427
2427
println ! ( "WARNING: download-rustc is disabled with `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` env." ) ;
@@ -2733,14 +2733,9 @@ impl Config {
2733
2733
crate :: exit!( 1 ) ;
2734
2734
}
2735
2735
2736
- // Warn if there were changes to the compiler or standard library since the ancestor commit.
2737
- let has_changes = !t ! ( helpers:: git( Some ( & self . src) )
2738
- . args( [ "diff-index" , "--quiet" , & commit] )
2739
- . arg( "--" )
2740
- . args( [ self . src. join( "compiler" ) , self . src. join( "library" ) ] )
2741
- . as_command_mut( )
2742
- . status( ) )
2743
- . success ( ) ;
2736
+ let dirs = vec ! [ PathBuf :: from( "compiler" ) , PathBuf :: from( "library" ) ] ;
2737
+ let has_changes = self . check_for_changes ( & dirs, & commit) ;
2738
+
2744
2739
if has_changes {
2745
2740
if if_unchanged {
2746
2741
if self . is_verbose ( ) {
@@ -2855,6 +2850,20 @@ impl Config {
2855
2850
2856
2851
Some ( commit. to_string ( ) )
2857
2852
}
2853
+
2854
+ /// Check for changes in specified directories since a given commit.
2855
+ /// Returns true if changes exist, false if no changes
2856
+ pub fn check_for_changes ( & self , dirs : & [ PathBuf ] , commit : & str ) -> bool {
2857
+ let mut git = helpers:: git ( Some ( & self . src ) ) ;
2858
+ git. args ( [ "diff-index" , "--quiet" , commit] ) ;
2859
+ if !dirs. is_empty ( ) {
2860
+ git. arg ( "--" ) ;
2861
+ for dir in dirs {
2862
+ git. arg ( self . src . join ( dir) ) ;
2863
+ }
2864
+ }
2865
+ !t ! ( git. as_command_mut( ) . status( ) ) . success ( )
2866
+ }
2858
2867
}
2859
2868
2860
2869
/// Compares the current `Llvm` options against those in the CI LLVM builder and detects any incompatible options.
0 commit comments