Skip to content

Commit e2c5999

Browse files
Dont use --merge-base during bootstrap formatting subcommand
1 parent 7c99186 commit e2c5999

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/bootstrap/format.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,19 @@ fn update_rustfmt_version(build: &Builder<'_>) {
7979
///
8080
/// Returns `None` if all files should be formatted.
8181
fn get_modified_rs_files(build: &Builder<'_>) -> Option<Vec<String>> {
82-
let Ok(remote) = get_rust_lang_rust_remote() else {return None;};
82+
let Ok(remote) = get_rust_lang_rust_remote() else { return None; };
8383
if !verify_rustfmt_version(build) {
8484
return None;
8585
}
86+
87+
let merge_base =
88+
output(build.config.git().arg("merge-base").arg(&format!("{remote}/master")).arg("HEAD"));
8689
Some(
87-
output(
88-
build
89-
.config
90-
.git()
91-
.arg("diff-index")
92-
.arg("--name-only")
93-
.arg("--merge-base")
94-
.arg(&format!("{remote}/master")),
95-
)
96-
.lines()
97-
.map(|s| s.trim().to_owned())
98-
.filter(|f| Path::new(f).extension().map_or(false, |ext| ext == "rs"))
99-
.collect(),
90+
output(build.config.git().arg("diff-index").arg("--name-only").arg(merge_base.trim()))
91+
.lines()
92+
.map(|s| s.trim().to_owned())
93+
.filter(|f| Path::new(f).extension().map_or(false, |ext| ext == "rs"))
94+
.collect(),
10095
)
10196
}
10297

0 commit comments

Comments
 (0)