Skip to content

Commit 2404de6

Browse files
authored
Merge pull request #307 from Nilstrieb/default-github
Default to `--access github`
2 parents a825626 + d8562d0 commit 2404de6

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

Diff for: guide/src/rust-src-repo.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,30 @@
33
For `cargo-bisect-rustc` to work, it needs to be able to read the git log of the [`rust-lang/rust`] repo.
44
`cargo-bisect-rustc` supports several methods for this described below.
55

6+
## GitHub API
7+
8+
By default, `cargo-bisect-rustc` uses the GitHub API to fetch the information instead of using a local checkout.
9+
10+
```sh
11+
cargo bisect-rustc --access=github
12+
```
13+
14+
Beware that GitHub has restrictive rate limits for unauthenticated requests.
15+
It allows 60 requests per hour, and `cargo-bisect-rustc` will use about 10 requests each time you run it (which can vary depending on the bisection).
16+
If you run into the rate limit, you can raise it to 5000 requests per hour by setting the `GITHUB_TOKEN` environment variable to a [GitHub personal token].
17+
If you use the [`gh` CLI tool], you can use it to get a token:
18+
19+
```sh
20+
GITHUB_TOKEN=`gh auth token` cargo bisect-rustc --access=github
21+
```
22+
23+
If you don't use `gh`, you'll just need to copy and paste the token.
24+
625
## Local clone
726

8-
By default, `cargo-bisect-rustc` will clone the rust repo in the current directory (as `rust.git`).
9-
This option can be quite slow, but doesn't require any setup.
27+
`cargo-bisect-rustc` can also clone the rust repo in the current directory (as `rust.git`).
28+
This option can be quite slow if you don't specify the repo path at build time.
29+
You can specify this with the `--access` CLI argument:
1030

1131
## `RUST_SRC_REPO` environment variable
1232

@@ -26,26 +46,6 @@ This is recommended if you already have the rust repo checked out somewhere.
2646
RUST_SRC_REPO=/path/to/rust cargo install cargo-bisect-rustc
2747
```
2848

29-
## GitHub API
30-
31-
`cargo-bisect-rustc` can use the GitHub API to fetch the information instead of using a local checkout.
32-
You can specify this with the `--access` CLI argument:
33-
34-
```sh
35-
cargo bisect-rustc --access=github
36-
```
37-
38-
Beware that GitHub has restrictive rate limits for unauthenticated requests.
39-
It allows 60 requests per hour, and `cargo-bisect-rustc` will use about 10 requests each time you run it (which can vary depending on the bisection).
40-
If you run into the rate limit, you can raise it to 5000 requests per hour by setting the `GITHUB_TOKEN` environment variable to a [GitHub personal token].
41-
If you use the [`gh` CLI tool], you can use it to get a token:
42-
43-
```sh
44-
GITHUB_TOKEN=`gh auth token` cargo bisect-rustc --access=github
45-
```
46-
47-
If you don't use `gh`, you'll just need to copy and paste the token.
48-
4949
[`rust-lang/rust`]: https://github.com/rust-lang/rust/
5050
[GitHub personal token]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
5151
[`gh` CLI tool]: https://cli.github.com/

Diff for: src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ a date (YYYY-MM-DD), git tag name (e.g. 1.58.0) or git commit SHA."
166166
#[arg(long, help = "Bisect via commit artifacts")]
167167
by_commit: bool,
168168

169-
#[arg(long, value_enum, help = "How to access Rust git repository", default_value_t = Access::Checkout)]
169+
#[arg(long, value_enum, help = "How to access Rust git repository", default_value_t = Access::Github)]
170170
access: Access,
171171

172172
#[arg(long, help = "Install the given artifact")]

Diff for: tests/cmd/h.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Arguments:
77

88
Options:
99
-a, --alt Download the alt build instead of normal build
10-
--access <ACCESS> How to access Rust git repository [default: checkout] [possible
10+
--access <ACCESS> How to access Rust git repository [default: github] [possible
1111
values: checkout, github]
1212
--by-commit Bisect via commit artifacts
1313
-c, --component <COMPONENTS> additional components to install

Diff for: tests/cmd/help.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Options:
1313
--access <ACCESS>
1414
How to access Rust git repository
1515

16-
[default: checkout]
16+
[default: github]
1717
[possible values: checkout, github]
1818

1919
--by-commit

0 commit comments

Comments
 (0)