@@ -2413,7 +2413,7 @@ impl Config {
24132413
24142414 let disable_ci_rustc_if_incompatible =
24152415 env:: var_os ( "DISABLE_CI_RUSTC_IF_INCOMPATIBLE" )
2416- . is_some_and ( |s| s == "1" || s == "true" ) ;
2416+ . is_some_and ( |s| s == "1" || s == "true" ) ;
24172417
24182418 if disable_ci_rustc_if_incompatible && res. is_err ( ) {
24192419 println ! ( "WARNING: download-rustc is disabled with `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` env." ) ;
@@ -2725,14 +2725,9 @@ impl Config {
27252725 crate :: exit!( 1 ) ;
27262726 }
27272727
2728- // Warn if there were changes to the compiler or standard library since the ancestor commit.
2729- let has_changes = !t ! ( helpers:: git( Some ( & self . src) )
2730- . args( [ "diff-index" , "--quiet" , & commit] )
2731- . arg( "--" )
2732- . args( [ self . src. join( "compiler" ) , self . src. join( "library" ) ] )
2733- . as_command_mut( )
2734- . status( ) )
2735- . success ( ) ;
2728+ let dirs = vec ! [ PathBuf :: from( "compiler" ) , PathBuf :: from( "library" ) ] ;
2729+ let has_changes = self . check_for_changes ( & dirs, & commit) ;
2730+
27362731 if has_changes {
27372732 if if_unchanged {
27382733 if self . is_verbose ( ) {
@@ -2847,6 +2842,20 @@ impl Config {
28472842
28482843 Some ( commit. to_string ( ) )
28492844 }
2845+
2846+ /// Check for changes in specified directories since a given commit.
2847+ /// Returns true if changes exist, false if no changes
2848+ pub fn check_for_changes ( & self , dirs : & [ PathBuf ] , commit : & str ) -> bool {
2849+ let mut git = helpers:: git ( Some ( & self . src ) ) ;
2850+ git. args ( [ "diff-index" , "--quiet" , commit] ) ;
2851+ if !dirs. is_empty ( ) {
2852+ git. arg ( "--" ) ;
2853+ for dir in dirs {
2854+ git. arg ( self . src . join ( dir) ) ;
2855+ }
2856+ }
2857+ !t ! ( git. as_command_mut( ) . status( ) ) . success ( )
2858+ }
28502859}
28512860
28522861/// Compares the current `Llvm` options against those in the CI LLVM builder and detects any incompatible options.
0 commit comments