Skip to content

Commit c31a43d

Browse files
bors[bot]dragfire
andauthored
Merge #5862
5862: Add a test that forbids merge commits r=matklad a=dragfire Fixes #5854 Co-authored-by: dragfire <[email protected]>
2 parents 148a60b + cdebf02 commit c31a43d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
steps:
3131
- name: Checkout repository
3232
uses: actions/checkout@v2
33+
with:
34+
ref: ${{ github.event.pull_request.head.sha }}
35+
fetch-depth: 5
3336

3437
# We need to disable the existing toolchain to avoid updating rust-docs
3538
# which takes a long time. The fastest way to do this is to rename the

xtask/tests/tidy.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ fn rust_files_are_tidy() {
5050
tidy_docs.finish();
5151
}
5252

53+
#[test]
54+
fn check_merge_commits() {
55+
let cmd_output =
56+
run!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~4.."; echo = false);
57+
match cmd_output {
58+
Ok(out) => {
59+
if !out.is_empty() {
60+
panic!("Please rebase your branch on top of master by running `git rebase master`");
61+
}
62+
}
63+
Err(e) => panic!("{}", e),
64+
}
65+
}
66+
5367
fn deny_clippy(path: &PathBuf, text: &String) {
5468
if text.contains("[\u{61}llow(clippy") {
5569
panic!(

0 commit comments

Comments
 (0)