@@ -2421,7 +2421,7 @@ impl Config {
24212421
24222422 let disable_ci_rustc_if_incompatible =
24232423 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" ) ;
24252425
24262426 if disable_ci_rustc_if_incompatible && res. is_err ( ) {
24272427 println ! ( "WARNING: download-rustc is disabled with `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` env." ) ;
@@ -2733,14 +2733,9 @@ impl Config {
27332733 crate :: exit!( 1 ) ;
27342734 }
27352735
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+
27442739 if has_changes {
27452740 if if_unchanged {
27462741 if self . is_verbose ( ) {
@@ -2855,6 +2850,20 @@ impl Config {
28552850
28562851 Some ( commit. to_string ( ) )
28572852 }
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+ }
28582867}
28592868
28602869/// Compares the current `Llvm` options against those in the CI LLVM builder and detects any incompatible options.
0 commit comments