Skip to content

Commit 292072d

Browse files
calebcartwrightjyn514
authored andcommitted
enhance subtree docs, link to clippy docs
1 parent 0f69d33 commit 292072d

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

src/contributing.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -172,32 +172,34 @@ differently from other crates that are directly in this repo:
172172
* [Clippy](https://github.com/rust-lang/rust-clippy)
173173
* [rustfmt](https://github.com/rust-lang/rustfmt)
174174

175-
They are just regular files and directories. This is in contrast to `submodule` dependencies
176-
(see below for those). Only tool authors will actually use any operations here.
175+
In contrast to `submodule` dependencies
176+
(see below for those), the `subtree` dependencies are just regular files and directories which can
177+
be updated in tree. However, enhancements, bug fixes, etc. specific to these tools should be filed
178+
against the tools directly in their respective upstream repositories.
177179

178180
#### Synchronizing a subtree
179181

180-
There are two synchronization directions: `subtree push` and `subtree pull`.
182+
Periodically the changes made to subtree based dependencies need to be synchronized between this
183+
repository and the upstream tool repositories.
181184

182-
```
183-
git subtree push -P src/tools/clippy [email protected]:your-github-name/rust-clippy sync-from-rust
184-
```
185-
186-
takes all the changes that
187-
happened to the copy in this repo and creates commits on the remote repo that match the local
188-
changes. Every local commit that touched the subtree causes a commit on the remote repo, but is
189-
modified to move the files from the specified directory to the tool repo root.
185+
Subtree synchronizations are typically handled by the respective tool maintainers. Other users
186+
are welcome to submit synchronization PRs, however, in order to do so you you will need to modify
187+
your local git installation and follow a very precise set of instructions.
188+
These instructions are documented, along with several useful tips and tricks, in the
189+
[syncing subtree changes][clippy-sync-docs] section in Clippy's Contributing guide.
190+
The instructions are applicable for use with any subtree based tool, just be sure to
191+
use the correct corresponding subtree directory and remote repository.
190192

191-
Make sure to not pick the `master` branch on the tool repo, so you can open a normal PR to the tool
192-
to merge that subrepo push.
193+
The synchronization process goes in two directions: `subtree push` and `subtree pull`.
193194

194-
```
195-
git subtree pull -P src/tools/clippy https://github.com/rust-lang/rust-clippy master
196-
```
195+
A `subtree push` takes all the changes that happened to the copy in this repo and creates commits
196+
on the remote repo that match the local changes. Every local
197+
commit that touched the subtree causes a commit on the remote repo, but
198+
is modified to move the files from the specified directory to the tool repo root.
197199

198-
takes all changes since the last `subtree pull` from the tool repo
199-
and adds these commits to the rustc repo + a merge commit that moves the tool changes into
200-
the specified directory in the rust repository.
200+
A `subtree pull` takes all changes since the last `subtree pull`
201+
from the tool repo and adds these commits to the rustc repo along with a merge commit that moves
202+
the tool changes into the specified directory in the rust repository.
201203

202204
It is recommended that you always do a push first and get that merged to the tool master branch.
203205
Then, when you do a pull, the merge works without conflicts.
@@ -212,6 +214,8 @@ Luckily you can just abort this without any consequences by throwing away either
212214
in rustc or the pushed branch on the remote and try again. It is usually fairly obvious
213215
that this is happening because you suddenly get thousands of commits that want to be synchronized.
214216

217+
[clippy-sync-docs]: https://github.com/rust-lang/rust-clippy/blob/master/CONTRIBUTING.md#syncing-changes-between-clippy-and-rust-langrust
218+
215219
#### Creating a new subtree dependency
216220

217221
If you want to create a new subtree dependency from an existing repository, call (from this

0 commit comments

Comments
 (0)