@@ -85,11 +85,15 @@ fn update_rustfmt_version(build: &Builder<'_>) {
8585 t ! ( stamp_file. add_stamp( version) . write( ) ) ;
8686}
8787
88- /// Returns the Rust files modified between the ` merge-base` of HEAD and
89- /// rust-lang/master and what is now on the disk. Does not include removed files.
88+ /// Returns the Rust files modified between the last merge commit and what is now on the disk.
89+ /// Does not include removed files.
9090///
9191/// Returns `None` if all files should be formatted.
9292fn get_modified_rs_files ( build : & Builder < ' _ > ) -> Result < Option < Vec < String > > , String > {
93+ // In CI `get_git_modified_files` returns something different to normal environment.
94+ // This shouldn't be called in CI anyway.
95+ assert ! ( !build. config. is_running_on_ci) ;
96+
9397 if !verify_rustfmt_version ( build) {
9498 return Ok ( None ) ;
9599 }
@@ -104,7 +108,7 @@ struct RustfmtConfig {
104108
105109// Prints output describing a collection of paths, with lines such as "formatted modified file
106110// foo/bar/baz" or "skipped 20 untracked files".
107- fn print_paths ( build : & Builder < ' _ > , verb : & str , adjective : Option < & str > , paths : & [ String ] ) {
111+ fn print_paths ( verb : & str , adjective : Option < & str > , paths : & [ String ] ) {
108112 let len = paths. len ( ) ;
109113 let adjective =
110114 if let Some ( adjective) = adjective { format ! ( "{adjective} " ) } else { String :: new ( ) } ;
@@ -115,9 +119,6 @@ fn print_paths(build: &Builder<'_>, verb: &str, adjective: Option<&str>, paths:
115119 } else {
116120 println ! ( "fmt: {verb} {len} {adjective}files" ) ;
117121 }
118- if len > 1000 && !build. config . is_running_on_ci {
119- println ! ( "hint: if this number seems too high, try running `git fetch origin master`" ) ;
120- }
121122}
122123
123124pub fn format ( build : & Builder < ' _ > , check : bool , all : bool , paths : & [ PathBuf ] ) {
@@ -190,7 +191,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
190191 )
191192 . map ( |x| x. to_string ( ) )
192193 . collect ( ) ;
193- print_paths ( build , "skipped" , Some ( "untracked" ) , & untracked_paths) ;
194+ print_paths ( "skipped" , Some ( "untracked" ) , & untracked_paths) ;
194195
195196 for untracked_path in untracked_paths {
196197 // The leading `/` makes it an exact match against the
@@ -319,7 +320,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
319320 } ) ;
320321 let mut paths = formatted_paths. into_inner ( ) . unwrap ( ) ;
321322 paths. sort ( ) ;
322- print_paths ( build , if check { "checked" } else { "formatted" } , adjective, & paths) ;
323+ print_paths ( if check { "checked" } else { "formatted" } , adjective, & paths) ;
323324
324325 drop ( tx) ;
325326
0 commit comments