diff options
| author | Michael Goulet <michael@errs.io> | 2022-12-30 21:26:36 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-30 21:26:36 -0800 |
| commit | 96e32a49c9bdba7dae3e891e16d663f3745f30de (patch) | |
| tree | 0eb35b1a5b56bc6363f45263f49a3df7717cc1fc | |
| parent | 93032e8112066612263eddf45d58c0438f3f5a54 (diff) | |
| parent | e2c5999265916399b0700b513cda0221fc8f7ad3 (diff) | |
| download | rust-96e32a49c9bdba7dae3e891e16d663f3745f30de.tar.gz rust-96e32a49c9bdba7dae3e891e16d663f3745f30de.zip | |
Rollup merge of #106310 - compiler-errors:old-git, r=jyn514
Dont use `--merge-base` during bootstrap formatting subcommand I use a development image with Ubuntu 20.04 LTS, which has git 2.25. Recently, `./x.py test tidy --bless` regressed in #105702 because it uses the `--merge-base` option on `diff-index`, which was only introduced in git 2.30 (git/git@0f5a1d449b9538c2765de9d6683abbb83a7fb4e2). Luckily, it can be replicated via two calls to `git merge-base` + `git diff-index`, so let's just use that.
| -rw-r--r-- | src/bootstrap/format.rs | 23 |
1 files changed, 9 insertions, 14 deletions
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<Vec<String>> { - 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(), ) } |
