3 Sometimes it is necessary to backport changes to the beta release of Clippy.
4 Backports in Clippy are rare and should be approved by the Clippy team. For
5 example, a backport is done, if a crucial ICE was fixed or a lint is broken to a
6 point, that it has to be disabled, before landing on stable.
8 Backports are done to the `beta` branch of Clippy. Backports to stable Clippy
9 releases basically don't exist, since this would require a Rust point release,
10 which is almost never justifiable for a Clippy fix.
13 ## Backport the changes
15 Backports are done on the beta branch of the Clippy repository.
18 # Assuming the current directory corresponds to the Clippy repository
20 $ git checkout -b backport
21 $ git cherry-pick <SHA> # `<SHA>` is the commit hash of the commit(s), that should be backported
22 $ git push origin backport
25 Now you should test that the backport passes all the tests in the Rust
26 repository. You can do this with:
29 # Assuming the current directory corresponds to the Rust repository
31 $ git subtree pull -p src/tools/clippy https://github.com/<your-github-name>/rust-clippy backport
32 $ ./x.py test src/tools/clippy
35 Should the test fail, you can fix Clippy directly in the Rust repository. This
36 has to be first applied to the Clippy beta branch and then again synced to the
37 Rust repository, though. The easiest way to do this is:
40 # In the Rust repository
41 $ git diff --patch --relative=src/tools/clippy > clippy.patch
42 # In the Clippy repository
43 $ git apply /path/to/clippy.patch
45 $ git commit -m "Fix rustup fallout"
46 $ git push origin backport
49 After this, you can open a PR to the `beta` branch of the Clippy repository.
52 ## Update Clippy in the Rust Repository
54 This step must be done, **after** the PR of the previous step was merged.
56 After the backport landed in the Clippy repository, the branch has to be synced
57 back to the beta branch of the Rust repository.
60 # Assuming the current directory corresponds to the Rust repository
62 $ git checkout -b clippy_backport
63 $ git subtree pull -p src/tools/clippy https://github.com/rust-lang/rust-clippy beta
64 $ git push origin clippy_backport
67 Make sure to test the backport in the Rust repository before opening a PR. This
68 is done with `./x.py test src/tools/clippy`. If that passes all tests, open a PR
69 to the `beta` branch of the Rust repository. In this PR you should tag the
70 Clippy team member, that agreed to the backport or the `@rust-lang/clippy` team.
71 Make sure to add `[beta]` to the title of the PR.