mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
add no-new-root check to josh pull
This commit is contained in:
parent
47a901b9bf
commit
b4ad65b394
1 changed files with 13 additions and 0 deletions
|
@ -95,6 +95,14 @@ impl flags::RustcPull {
|
||||||
if !cmd!(sh, "git status --untracked-files=no --porcelain").read()?.is_empty() {
|
if !cmd!(sh, "git status --untracked-files=no --porcelain").read()?.is_empty() {
|
||||||
bail!("working directory must be clean before running `cargo xtask pull`");
|
bail!("working directory must be clean before running `cargo xtask pull`");
|
||||||
}
|
}
|
||||||
|
// This should not add any new root commits. So count those before and after merging.
|
||||||
|
let num_roots = || -> anyhow::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()?;
|
||||||
// Make sure josh is running.
|
// Make sure josh is running.
|
||||||
let josh = start_josh()?;
|
let josh = start_josh()?;
|
||||||
|
|
||||||
|
@ -126,6 +134,11 @@ impl flags::RustcPull {
|
||||||
.run()
|
.run()
|
||||||
.context("FAILED to merge new commits, something went wrong")?;
|
.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);
|
drop(josh);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue