@@ -85,11 +85,15 @@ fn update_rustfmt_version(build: &Builder<'_>) {
85
85
t ! ( stamp_file. add_stamp( version) . write( ) ) ;
86
86
}
87
87
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.
90
90
///
91
91
/// Returns `None` if all files should be formatted.
92
92
fn 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
+
93
97
if !verify_rustfmt_version ( build) {
94
98
return Ok ( None ) ;
95
99
}
@@ -104,7 +108,7 @@ struct RustfmtConfig {
104
108
105
109
// Prints output describing a collection of paths, with lines such as "formatted modified file
106
110
// 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 ] ) {
108
112
let len = paths. len ( ) ;
109
113
let adjective =
110
114
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:
115
119
} else {
116
120
println ! ( "fmt: {verb} {len} {adjective}files" ) ;
117
121
}
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
- }
121
122
}
122
123
123
124
pub 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]) {
190
191
)
191
192
. map ( |x| x. to_string ( ) )
192
193
. collect ( ) ;
193
- print_paths ( build , "skipped" , Some ( "untracked" ) , & untracked_paths) ;
194
+ print_paths ( "skipped" , Some ( "untracked" ) , & untracked_paths) ;
194
195
195
196
for untracked_path in untracked_paths {
196
197
// The leading `/` makes it an exact match against the
@@ -319,7 +320,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
319
320
} ) ;
320
321
let mut paths = formatted_paths. into_inner ( ) . unwrap ( ) ;
321
322
paths. sort ( ) ;
322
- print_paths ( build , if check { "checked" } else { "formatted" } , adjective, & paths) ;
323
+ print_paths ( if check { "checked" } else { "formatted" } , adjective, & paths) ;
323
324
324
325
drop ( tx) ;
325
326
0 commit comments