X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fbootstrap%2Fformat.rs;h=84e4611895965ce22dfa63b7d75516813c113821;hb=d6f99e535a301a421dfee52a7c25bb4bdf420344;hp=1d57c6ecbbb8d93167cc195b38b44d6f2f5fd8a2;hpb=ff3326d9253b1043b327aa5d04f8ef85973e02b1;p=rust.git diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs index 1d57c6ecbbb..84e46118959 100644 --- a/src/bootstrap/format.rs +++ b/src/bootstrap/format.rs @@ -79,24 +79,19 @@ fn update_rustfmt_version(build: &Builder<'_>) { /// /// Returns `None` if all files should be formatted. fn get_modified_rs_files(build: &Builder<'_>) -> Option> { - let Ok(remote) = get_rust_lang_rust_remote() else {return None;}; + let Ok(remote) = get_rust_lang_rust_remote() else { return None; }; if !verify_rustfmt_version(build) { return None; } + + let merge_base = + output(build.config.git().arg("merge-base").arg(&format!("{remote}/master")).arg("HEAD")); Some( - output( - build - .config - .git() - .arg("diff-index") - .arg("--name-only") - .arg("--merge-base") - .arg(&format!("{remote}/master")), - ) - .lines() - .map(|s| s.trim().to_owned()) - .filter(|f| Path::new(f).extension().map_or(false, |ext| ext == "rs")) - .collect(), + output(build.config.git().arg("diff-index").arg("--name-only").arg(merge_base.trim())) + .lines() + .map(|s| s.trim().to_owned()) + .filter(|f| Path::new(f).extension().map_or(false, |ext| ext == "rs")) + .collect(), ) }