Change:
The skipped files are files in the repo that are not tracked by git. It looks like they might still get to the "formatted modified file" counter? I have no other changed files in the repo, so I wonder what rustfmt is saying to have formatted here :sweat_smile:
It detects X files modified, but the fact that they are not tracked means that their rustfmt invocation will be skipped.
It's better to give different counts for skipped and formatted files?
Maybe soemthing like "formatted x files, skipped y untracked files" would make more sense.
The number is actually right, but it's the number of the files that have been modified in the current branch compared to the master branch: you have 86 untracked path in this case. Anywa, we can make it more explicit here.

Discussion:
} let rustfmt_config = t!(std::fs::read_to_string(&rustfmt_config)); let rustfmt_config: RustfmtConfig = t!(toml::from_str(&rustfmt_config)); <del> let mut ignore_fmt = ignore::overrides::OverrideBuilder::new(&build.src); </del> <ins> let mut fmt_override = ignore::overrides::OverrideBuilder::new(&build.src); </ins> for ignore in rustfmt_config.ignore { <del> ignore_fmt.add(&format!("!{ignore}")).expect(&ignore); </del> <ins> fmt_override.add(&format!("!{ignore}")).expect(&ignore); </ins> } let git_available = match Command::new("git") .arg("--version")

.map(|entry| { entry.split(' ').nth(1).expect("every git status entry should list a path") }); <ins> let mut untracked_count = 0; </ins> for untracked_path in untracked_paths { println!("skip untracked path {untracked_path} during rustfmt invocations"); // The leading `/` makes it an exact match against the

// have `foo.rs` in the repository root it will also match // against anything like `compiler/rustc_foo/src/foo.rs`, // preventing the latter from being formatted. <del> ignore_fmt.add(&format!("!/{untracked_path}")).expect(&untracked_path); </del> <ins> untracked_count += 1; fmt_override.add(&format!("!/{untracked_path}")).expect(&untracked_path); </ins> } // Only check modified files locally to speed up runtime. // We still check all files in CI to avoid bugs in `get_modified_rs_files` letting regressions slip through;

println!("formatting modified file {file}"); } } else { <del> println!("formatting {} modified files", files.len()); </del> <ins> let pluralized = |count| if count > 1 { "files" } else { "file" }; let untracked_msg = if untracked_count == 0 { "".to_string() } else { format!( ", skipped {} untracked {}", untracked_count, pluralized(untracked_count), ) }; println!( "formatting {} modified {}{}", files.len(), pluralized(files.len()), untracked_msg ); </ins> } for file in files { <del> ignore_fmt.add(&format!("/{file}")).expect(&file); </del> <ins> fmt_override.add(&format!("/{file}")).expect(&file); </ins> } } Ok(None) => {}

println!("Could not find usable git. Skipping git-aware format checks"); } <del> let ignore_fmt = ignore_fmt.build().unwrap(); </del> <ins> let fmt_override = fmt_override.build().unwrap(); </ins> let rustfmt_path = build.initial_rustfmt().unwrap_or_else(|| { eprintln!("./x.py fmt is not supported on this channel");

None => WalkBuilder::new(src.clone()), } .types(matcher) <del> .overrides(ignore_fmt) </del> <ins> .overrides(fmt_override) </ins> .build_parallel(); // there is a lot of blocking involved in spawning a child process and reading files to format.