@@ -152,13 +152,15 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
152152 . map ( |entry| {
153153 entry. split ( ' ' ) . nth ( 1 ) . expect ( "every git status entry should list a path" )
154154 } ) ;
155+ let mut untracked_count = 0 ;
155156 for untracked_path in untracked_paths {
156157 println ! ( "skip untracked path {untracked_path} during rustfmt invocations" ) ;
157158 // The leading `/` makes it an exact match against the
158159 // repository root, rather than a glob. Without that, if you
159160 // have `foo.rs` in the repository root it will also match
160161 // against anything like `compiler/rustc_foo/src/foo.rs`,
161162 // preventing the latter from being formatted.
163+ untracked_count += 1 ;
162164 ignore_fmt. add ( & format ! ( "!/{untracked_path}" ) ) . expect ( & untracked_path) ;
163165 }
164166 // Only check modified files locally to speed up runtime.
@@ -167,13 +169,28 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
167169 if !CiEnv :: is_ci ( ) && paths. is_empty ( ) {
168170 match get_modified_rs_files ( build) {
169171 Ok ( Some ( files) ) => {
172+ eprintln ! ( "Found {:?} modified files" , files) ;
170173 if files. len ( ) <= 10 {
171174 for file in & files {
172175 println ! ( "formatting modified file {file}" ) ;
173176 }
174- } else {
175- println ! ( "formatting {} modified files" , files. len( ) ) ;
176177 }
178+ let pluralized = |count| if count > 1 { "files" } else { "file" } ;
179+ let untracked_msg = if untracked_count == 0 {
180+ "" . to_string ( )
181+ } else {
182+ format ! (
183+ ", skipped {} untracked {}" ,
184+ untracked_count,
185+ pluralized( untracked_count) ,
186+ )
187+ } ;
188+ println ! (
189+ "formatting {} modified {}{}" ,
190+ files. len( ) ,
191+ pluralized( files. len( ) ) ,
192+ untracked_msg
193+ ) ;
177194 for file in files {
178195 ignore_fmt. add ( & format ! ( "/{file}" ) ) . expect ( & file) ;
179196 }
0 commit comments