Skip to content

Commit 9787dc1

Browse files
authored
Add to the readme an example of subtree checkout (#164)
1.added a short explanation on how to add a repo's subtree 2.removed ssh from examples
1 parent bd9d7a1 commit 9787dc1

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,18 @@ allow_policies = ["/prefix/*", "*/subpath/*", "/path/to/file.proto"]
9999

100100
[dep2]
101101
url = "github.com/org/dep2"
102-
protocol = "ssh"
103102
branch = "feature/v2"
104103

105104
[another-name]
106-
protocol = "ssh"
107105
url = "github.com/org/dep3"
108106
revision = "a16f097eab6e64f2b711fd4b977e610791376223"
109107
transitive = true
108+
109+
[scoped-down-dep4]
110+
url = "github.com/org/dep4"
111+
revision = "v1.1"
112+
content_roots = ["/scope/path"]
113+
allow_policies = ["prefix/subpath/scoped_path/*"]
110114
```
111115

112116
## Git protocol
@@ -131,6 +135,30 @@ The following permissions are sufficient when creating the token.
131135

132136
![GitHub personal access token](readme-images/github-personal-access-token.png)
133137

138+
## Scope down multi API repo
139+
140+
In the case of a repo that supports multiple APIs, but only a specific directory is needed, a combination of `content_roots` and `allow_policies` can be used.
141+
142+
For example: the `dep4` repo contains the following:
143+
```sh
144+
dep4
145+
├── scope
146+
│ ├── path1
147+
│ └── path2
148+
└── scope2
149+
└── unrelated
150+
```
151+
We only need protobuf files from `dep4/scope/path1`, where `path1` is the package name.
152+
153+
```toml
154+
[scoped-down-dep4]
155+
url = "github.com/org/dep4"
156+
revision = "v1.1"
157+
content_roots = ["/scope"]
158+
allow_policies = ["path1/*"]
159+
```
160+
161+
134162
## Transitive dependency support and pruning
135163

136164
Protofetch supports pulling transitive dependencies for your convenience.

0 commit comments

Comments
 (0)