From cdebf02e5490989efc159cd1b4bc0645713e1dfc Mon Sep 17 00:00:00 2001 From: dragfire Date: Mon, 24 Aug 2020 15:17:00 -0600 Subject: Add a test that forbids merge commits --- xtask/tests/tidy.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'xtask') diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index fd9645c23..c276b6307 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs @@ -50,6 +50,20 @@ fn rust_files_are_tidy() { tidy_docs.finish(); } +#[test] +fn check_merge_commits() { + let cmd_output = + run!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~4.."; echo = false); + match cmd_output { + Ok(out) => { + if !out.is_empty() { + panic!("Please rebase your branch on top of master by running `git rebase master`"); + } + } + Err(e) => panic!("{}", e), + } +} + fn deny_clippy(path: &PathBuf, text: &String) { if text.contains("[\u{61}llow(clippy") { panic!( -- cgit v1.2.3