diff options
| author | bors <bors@rust-lang.org> | 2024-04-27 08:20:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-27 08:20:22 +0000 |
| commit | 45d93945ad031b18cb723e8d4c65aa717366dd57 (patch) | |
| tree | 0e2dce3a6ea897c1a37a8e697263a53498f6cefd | |
| parent | f5ceb4ed6004e6841662ce00e8e8e22f4d06a709 (diff) | |
| parent | 2681edf93436a31ed0cfe127d8877c236627ffa3 (diff) | |
| download | rust-45d93945ad031b18cb723e8d4c65aa717366dd57.tar.gz rust-45d93945ad031b18cb723e8d4c65aa717366dd57.zip | |
Auto merge of #3520 - RalfJung:josh-check, r=RalfJung
josh rustc-pull: check that no new root commits get created A second root was a bad sign in Miri (judging from the description in https://github.com/rust-lang/miri/pull/2583) and seems to be a [bad sign in RA](https://github.com/rust-lang/rust-analyzer/pull/17025#issuecomment-2080390014). So let's add this to the sanity checks.
| -rw-r--r-- | src/tools/miri/miri-script/src/commands.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tools/miri/miri-script/src/commands.rs b/src/tools/miri/miri-script/src/commands.rs index 66707dee5e7..575bf4a15df 100644 --- a/src/tools/miri/miri-script/src/commands.rs +++ b/src/tools/miri/miri-script/src/commands.rs @@ -257,12 +257,26 @@ impl Command { }) .context("FAILED to fetch new commits, something went wrong (committing the rust-version file has been undone)")?; + // This should not add any new root commits. So count those before and after merging. + let num_roots = || -> Result<u32> { + Ok(cmd!(sh, "git rev-list HEAD --max-parents=0 --count") + .read() + .context("failed to determine the number of root commits")? + .parse::<u32>()?) + }; + let num_roots_before = num_roots()?; + // Merge the fetched commit. const MERGE_COMMIT_MESSAGE: &str = "Merge from rustc"; cmd!(sh, "git merge FETCH_HEAD --no-verify --no-ff -m {MERGE_COMMIT_MESSAGE}") .run() .context("FAILED to merge new commits, something went wrong")?; + // Check that the number of roots did not increase. + if num_roots()? != num_roots_before { + bail!("Josh created a new root commit. This is probably not the history you want."); + } + drop(josh); Ok(()) } |
