]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/book/src/development/infrastructure/backport.md
Merge commit 'd7b5cbf065b88830ca519adcb73fad4c0d24b1c7' into clippyup
[rust.git] / src / tools / clippy / book / src / development / infrastructure / backport.md
1 # Backport Changes
2
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.
7
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.
11
12
13 ## Backport the changes
14
15 Backports are done on the beta branch of the Clippy repository.
16
17 ```bash
18 # Assuming the current directory corresponds to the Clippy repository
19 $ git checkout beta
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
23 ```
24
25 Now you should test that the backport passes all the tests in the Rust
26 repository. You can do this with:
27
28 ```bash
29 # Assuming the current directory corresponds to the Rust repository
30 $ git checkout beta
31 $ git subtree pull -p src/tools/clippy https://github.com/<your-github-name>/rust-clippy backport
32 $ ./x.py test src/tools/clippy
33 ```
34
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:
38
39 ```bash
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
44 $ git add -u
45 $ git commit -m "Fix rustup fallout"
46 $ git push origin backport
47 ```
48
49 After this, you can open a PR to the `beta` branch of the Clippy repository.
50
51
52 ## Update Clippy in the Rust Repository
53
54 This step must be done, **after** the PR of the previous step was merged.
55
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.
58
59 ```bash
60 # Assuming the current directory corresponds to the Rust repository
61 $ git checkout beta
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
65 ```
66
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.