diff options
-rw-r--r-- | .github/workflows/ci.yaml | 2 | ||||
-rw-r--r-- | xtask/tests/tidy.rs | 40 |
2 files changed, 32 insertions, 10 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fa276e2bf..a19bc9ad3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml | |||
@@ -32,7 +32,7 @@ jobs: | |||
32 | uses: actions/checkout@v2 | 32 | uses: actions/checkout@v2 |
33 | with: | 33 | with: |
34 | ref: ${{ github.event.pull_request.head.sha }} | 34 | ref: ${{ github.event.pull_request.head.sha }} |
35 | fetch-depth: 5 | 35 | fetch-depth: 20 |
36 | 36 | ||
37 | # We need to disable the existing toolchain to avoid updating rust-docs | 37 | # We need to disable the existing toolchain to avoid updating rust-docs |
38 | # which takes a long time. The fastest way to do this is to rename the | 38 | # which takes a long time. The fastest way to do this is to rename the |
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index c276b6307..02b3afc96 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs | |||
@@ -52,15 +52,37 @@ fn rust_files_are_tidy() { | |||
52 | 52 | ||
53 | #[test] | 53 | #[test] |
54 | fn check_merge_commits() { | 54 | fn check_merge_commits() { |
55 | let cmd_output = | 55 | let stdout = run!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~19.."; echo = false) |
56 | run!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~4.."; echo = false); | 56 | .unwrap(); |
57 | match cmd_output { | 57 | if !stdout.is_empty() { |
58 | Ok(out) => { | 58 | panic!( |
59 | if !out.is_empty() { | 59 | " |
60 | panic!("Please rebase your branch on top of master by running `git rebase master`"); | 60 | Merge commits are not allowed in the history. |
61 | } | 61 | |
62 | } | 62 | When updating a pull-request, please rebase your feature branch |
63 | Err(e) => panic!("{}", e), | 63 | on top of master by running `git rebase master`. If rebase fails, |
64 | you can re-apply your changes like this: | ||
65 | |||
66 | # Abort in-progress rebase, if any. | ||
67 | $ git rebase --abort | ||
68 | |||
69 | # Make the branch point to the latest commit from master, | ||
70 | # while maintaining your local changes uncommited. | ||
71 | $ git reset --soft origin/master | ||
72 | |||
73 | # Commit all changes in a single batch. | ||
74 | $ git commit -am'My changes' | ||
75 | |||
76 | # Push the changes. We did a rebase, so we need `--force` option. | ||
77 | # `--force-with-lease` is a more safe (Rusty) version of `--force`. | ||
78 | $ git push --force-with-lease | ||
79 | |||
80 | And don't fear to mess something up during a rebase -- you can | ||
81 | always restore the previous state using `git ref-log`: | ||
82 | |||
83 | https://github.blog/2015-06-08-how-to-undo-almost-anything-with-git/#redo-after-undo-local | ||
84 | " | ||
85 | ); | ||
64 | } | 86 | } |
65 | } | 87 | } |
66 | 88 | ||