@@ -2413,7 +2413,7 @@ impl Config {
2413
2413
2414
2414
let disable_ci_rustc_if_incompatible =
2415
2415
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" ) ;
2417
2417
2418
2418
if disable_ci_rustc_if_incompatible && res. is_err ( ) {
2419
2419
println ! ( "WARNING: download-rustc is disabled with `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` env." ) ;
@@ -2725,14 +2725,9 @@ impl Config {
2725
2725
crate :: exit!( 1 ) ;
2726
2726
}
2727
2727
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
+
2736
2731
if has_changes {
2737
2732
if if_unchanged {
2738
2733
if self . is_verbose ( ) {
@@ -2847,6 +2842,20 @@ impl Config {
2847
2842
2848
2843
Some ( commit. to_string ( ) )
2849
2844
}
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
+ }
2850
2859
}
2851
2860
2852
2861
/// Compares the current `Llvm` options against those in the CI LLVM builder and detects any incompatible options.
0 commit comments