-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(): error context for git_fetch refspec not found #14806
Conversation
a91d980
to
7c698e5
Compare
7c698e5
to
cbb6075
Compare
e04acef
to
6838bee
Compare
tests/testsuite/git.rs
Outdated
[UPDATING] git repository `https://github.com/rust-lang/bitflags.git` | ||
[WARNING] spurious network error (3 tries remaining): could not read from remote repository; class=Net (12); code=Eof (-20) | ||
[WARNING] spurious network error (2 tries remaining): could not read from remote repository; class=Net (12); code=Eof (-20) | ||
[WARNING] spurious network error (1 tries remaining): could not read from remote repository; class=Net (12); code=Eof (-20) | ||
[ERROR] failed to get `bitflags` as a dependency of package `foo v0.1.0 ([ROOT]/foo)` | ||
|
||
Caused by: | ||
failed to load source for dependency `bitflags` | ||
|
||
Caused by: | ||
Unable to update https://github.com/rust-lang/bitflags.git?rev=11111b376b93484341c68fbca3ca110ae5cd2790 | ||
|
||
Caused by: | ||
failed to clone into: [ROOT]/home/.cargo/git/db/bitflags-[HASH] | ||
|
||
Caused by: | ||
revision 11111b376b93484341c68fbca3ca110ae5cd2790 not found | ||
|
||
Caused by: | ||
network failure seems to have happened | ||
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here | ||
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli | ||
|
||
Caused by: | ||
could not read from remote repository; class=Net (12); code=Eof (-20) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is interesting that the error message doesn't seem to be emitted on GitHub Actions machine, but only on my local machine.
If it still happens, instead of asserting the entire message, try omitting some parts we're not interested in with ...
(For the syntax, see https://doc.rust-lang.org/nightly/nightly-rustc/cargo_test_support/compare/index.html).
[UPDATING] git repository `https://github.com/rust-lang/bitflags.git` | |
[WARNING] spurious network error (3 tries remaining): could not read from remote repository; class=Net (12); code=Eof (-20) | |
[WARNING] spurious network error (2 tries remaining): could not read from remote repository; class=Net (12); code=Eof (-20) | |
[WARNING] spurious network error (1 tries remaining): could not read from remote repository; class=Net (12); code=Eof (-20) | |
[ERROR] failed to get `bitflags` as a dependency of package `foo v0.1.0 ([ROOT]/foo)` | |
Caused by: | |
failed to load source for dependency `bitflags` | |
Caused by: | |
Unable to update https://github.com/rust-lang/bitflags.git?rev=11111b376b93484341c68fbca3ca110ae5cd2790 | |
Caused by: | |
failed to clone into: [ROOT]/home/.cargo/git/db/bitflags-[HASH] | |
Caused by: | |
revision 11111b376b93484341c68fbca3ca110ae5cd2790 not found | |
Caused by: | |
network failure seems to have happened | |
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here | |
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli | |
Caused by: | |
could not read from remote repository; class=Net (12); code=Eof (-20) | |
[UPDATING] git repository `https://github.com/rust-lang/bitflags.git` | |
... | |
[ERROR] failed to get `bitflags` as a dependency of package `foo v0.1.0 ([ROOT]/foo)` | |
Caused by: | |
failed to load source for dependency `bitflags` | |
Caused by: | |
Unable to update https://github.com/rust-lang/bitflags.git?rev=11111b376b93484341c68fbca3ca110ae5cd2790 | |
Caused by: | |
failed to clone into: [ROOT]/home/.cargo/git/db/bitflags-[HASH] | |
Caused by: | |
revision 11111b376b93484341c68fbca3ca110ae5cd2790 not found | |
... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the context:
---- git::git_fetch_libgit2_error_message stdout ----
running `/Users/runner/work/cargo/cargo/target/debug/cargo fetch`
thread 'git::git_fetch_libgit2_error_message' panicked at tests/testsuite/git.rs:4163:10:
---- expected: tests/testsuite/git.rs:4135:27
++++ actual: stderr
1 1 | [UPDATING] git repository `[https://github.com/rust-lang/bitflags.git`](https://github.com/rust-lang/bitflags.git%60)
2 - [WARNING] spurious network error (3 tries remaining): could not read from remote repository; class=Net (12); code=Eof (-20)
3 - [WARNING] spurious network error (2 tries remaining): could not read from remote repository; class=Net (12); code=Eof (-20)
4 - [WARNING] spurious network error (1 tries remaining): could not read from remote repository; class=Net (12); code=Eof (-20)
5 2 | [ERROR] failed to get `bitflags` as a dependency of package `foo v0.1.0 ([ROOT]/foo)`
6 3 |
7 4 | Caused by:
8 5 | failed to load source for dependency `bitflags`
9 6 |
⋮
15 12 |
16 13 | Caused by:
17 14 | revision 11111b376b93484341c68fbca3ca110ae5cd2790 not found
18 15 |
19 16 | Caused by:
20 - network failure seems to have happened
21 - if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
22 - https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
17 + Could not decode server reply
23 18 |
24 19 | Caused by:
25 - could not read from remote repository; class=Net (12); code=Eof (-20)
20 + Unknown or unsupported header: "ERR upload-pack: not our ref 11111b376b93484341c68fbca3ca110ae5cd2790"
```
6838bee
to
a247968
Compare
a247968
to
43a5dee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Update cargo 5 commits in 69e595908e2c420e7f0d1be34e6c5b984c8cfb84..66221abdeca2002d318fde6efff516aab091df0e 2024-11-16 01:26:11 +0000 to 2024-11-19 21:30:02 +0000 - Docs for optional registry JSON fields (rust-lang/cargo#14839) - Allow registries to omit empty/default fields in JSON (rust-lang/cargo#14838) - docs(unstable): Link to -Zwarnings issue, tracking issue (rust-lang/cargo#14836) - fix(): error context for git_fetch refspec not found (rust-lang/cargo#14806) - you we distinction (rust-lang/cargo#14829)
Update cargo 5 commits in 69e595908e2c420e7f0d1be34e6c5b984c8cfb84..66221abdeca2002d318fde6efff516aab091df0e 2024-11-16 01:26:11 +0000 to 2024-11-19 21:30:02 +0000 - Docs for optional registry JSON fields (rust-lang/cargo#14839) - Allow registries to omit empty/default fields in JSON (rust-lang/cargo#14838) - docs(unstable): Link to -Zwarnings issue, tracking issue (rust-lang/cargo#14836) - fix(): error context for git_fetch refspec not found (rust-lang/cargo#14806) - you we distinction (rust-lang/cargo#14829)
Update cargo 5 commits in 69e595908e2c420e7f0d1be34e6c5b984c8cfb84..66221abdeca2002d318fde6efff516aab091df0e 2024-11-16 01:26:11 +0000 to 2024-11-19 21:30:02 +0000 - Docs for optional registry JSON fields (rust-lang/cargo#14839) - Allow registries to omit empty/default fields in JSON (rust-lang/cargo#14838) - docs(unstable): Link to -Zwarnings issue, tracking issue (rust-lang/cargo#14836) - fix(): error context for git_fetch refspec not found (rust-lang/cargo#14806) - you we distinction (rust-lang/cargo#14829)
Update cargo 5 commits in 69e595908e2c420e7f0d1be34e6c5b984c8cfb84..66221abdeca2002d318fde6efff516aab091df0e 2024-11-16 01:26:11 +0000 to 2024-11-19 21:30:02 +0000 - Docs for optional registry JSON fields (rust-lang/cargo#14839) - Allow registries to omit empty/default fields in JSON (rust-lang/cargo#14838) - docs(unstable): Link to -Zwarnings issue, tracking issue (rust-lang/cargo#14836) - fix(): error context for git_fetch refspec not found (rust-lang/cargo#14806) - you we distinction (rust-lang/cargo#14829)
What does this PR try to resolve?
Fixes Issue : #14621
Adds more error context for fetching a commit that doesn't exists.
How should we test and review this PR?
I've created two tests, one for fast_path and one for libgit2.
r? @weihanglo