Skip to content

Commit 99a731d

Browse files
committed
Book: Improve sync documentation
- Move doc about defining remotes to the front and use the defined remotes in the further documentation - Don't recommend pushing to the remote repo directly - Add some clarifying comments
1 parent 9305659 commit 99a731d

File tree

1 file changed

+29
-31
lines changed
  • book/src/development/infrastructure

1 file changed

+29
-31
lines changed

book/src/development/infrastructure/sync.md

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ sudo chown --reference=/usr/lib/git-core/git-subtree~ /usr/lib/git-core/git-subt
5151
> `bash` instead. You can do this by editing the first line of the `git-subtree`
5252
> script and changing `sh` to `bash`.
5353
54+
## Defining remotes
55+
56+
You may want to define remotes, so you don't have to type out the remote
57+
addresses on every sync. You can do this with the following commands (these
58+
commands still have to be run inside the `rust` directory):
59+
60+
```bash
61+
# Set clippy-upstream remote for pulls
62+
$ git remote add clippy-upstream https://github.com/rust-lang/rust-clippy
63+
# Make sure to not push to the upstream repo
64+
$ git remote set-url --push clippy-upstream DISABLED
65+
# Set a local remote
66+
$ git remote add clippy-local /path/to/rust-clippy
67+
```
68+
69+
> Note: The following sections assume that you have set those remotes with the
70+
> above remote names.
71+
5472
## Performing the sync from [`rust-lang/rust`] to Clippy
5573

5674
Here is a TL;DR version of the sync process (all of the following commands have
@@ -64,22 +82,25 @@ to be run inside the `rust` directory):
6482
# Make sure to change `your-github-name` to your github name in the following command. Also be
6583
# sure to either use a net-new branch, e.g. `sync-from-rust`, or delete the branch beforehand
6684
# because changes cannot be fast forwarded and you have to run this command again.
67-
git subtree push -P src/tools/clippy [email protected]:your-github-name/rust-clippy sync-from-rust
85+
git subtree push -P src/tools/clippy clippy-local sync-from-rust
6886
```
6987

70-
> _Note:_ This will directly push to the remote repository. You can also
71-
> push to your local copy by replacing the remote address with
72-
> `/path/to/rust-clippy` directory.
73-
7488
> _Note:_ Most of the time you have to create a merge commit in the
7589
> `rust-clippy` repo (this has to be done in the Clippy repo, not in the
7690
> rust-copy of Clippy):
7791
```bash
7892
git fetch upstream # assuming upstream is the rust-lang/rust remote
7993
git checkout sync-from-rust
80-
git merge upstream/master
94+
git merge upstream/master --no-ff
8195
```
82-
4. Open a PR to `rust-lang/rust-clippy` and wait for it to get merged (to
96+
> Note: This is one of the few instances where a merge commit is allowed in
97+
> a PR.
98+
4. Bump the nightly version in the Clippy repository by changing the date in the
99+
rust-toolchain file to the current date and committing it with the message:
100+
```bash
101+
git commit -m "Bump nightly version -> YYYY-MM-DD"
102+
```
103+
5. Open a PR to `rust-lang/rust-clippy` and wait for it to get merged (to
83104
accelerate the process ping the `@rust-lang/clippy` team in your PR and/or
84105
ask them in the [Zulip] stream.)
85106

@@ -93,33 +114,10 @@ All of the following commands have to be run inside the `rust` directory.
93114
2. Sync the `rust-lang/rust-clippy` master to the rust-copy of Clippy:
94115
```bash
95116
git checkout -b sync-from-clippy
96-
git subtree pull -P src/tools/clippy https://github.com/rust-lang/rust-clippy master
117+
git subtree pull -P src/tools/clippy clippy-upstream master
97118
```
98119
3. Open a PR to [`rust-lang/rust`]
99120

100-
## Defining remotes
101-
102-
You may want to define remotes, so you don't have to type out the remote
103-
addresses on every sync. You can do this with the following commands (these
104-
commands still have to be run inside the `rust` directory):
105-
106-
```bash
107-
# Set clippy-upstream remote for pulls
108-
$ git remote add clippy-upstream https://github.com/rust-lang/rust-clippy
109-
# Make sure to not push to the upstream repo
110-
$ git remote set-url --push clippy-upstream DISABLED
111-
# Set clippy-origin remote to your fork for pushes
112-
$ git remote add clippy-origin [email protected]:your-github-name/rust-clippy
113-
# Set a local remote
114-
$ git remote add clippy-local /path/to/rust-clippy
115-
```
116-
117-
You can then sync with the remote names from above, e.g.:
118-
119-
```bash
120-
$ git subtree push -P src/tools/clippy clippy-local sync-from-rust
121-
```
122-
123121
[gitgitgadget-pr]: https://github.com/gitgitgadget/git/pull/493
124122
[subtree]: https://rustc-dev-guide.rust-lang.org/contributing.html#external-dependencies-subtree
125123
[`rust-lang/rust`]: https://github.com/rust-lang/rust

0 commit comments

Comments
 (0)