-
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
Hint git-fetch-with-cli on git errors #8166
Conversation
I'm a bit hesitant to blindly recommend for any and all errors that git-fetch-with-cli is used instead. Would it be possible to catch specifically authentication errors and make that recommendation instead? Additionally could this link to online documentation about this configuration option? |
@alexcrichton I understand your concern. I've tried to narrow it down to specific libgit errors, but in the end it didn't feel like an improvement. The first problem is that it's not limited to just auth errors. In my case libgit not using our VPN-aware proxy looks like a regular network errors, e.g. DNS error and connection timeouts. Git errors generally fall into network errors, auth errors, invalid repo state, invalid command. The first two categories would benefit from the hint. The other two are unlikely to happen, because Cargo manages the repo state and commands itself. Another problem with this is that just getting to the relevant libgit error codes via anyhow's chain takes more code than the rest of the checkout function. I don't know if you'd be OK with such relatively complicated thing for a small check. |
Hm so extraction of error codes should be pretty simple, I think it's just calling I'd personally still prefer to limit this somehow. I think it's ok to be a bit broad, but if there's something like a corrupt db or if a remote branch doesn't exist then you shouldn't get a recommendation to switch git implementations. |
I've expanded it to check libgit's error class |
Tests for my change pass. The failure comes from another test, which seems unrelated:
|
@bors: r+ Looks great to me, thanks for this! Those test failures should be fixed on master now. |
📌 Commit 4fd4835 has been approved by |
☀️ Test successful - checks-azure |
This broke on rust-lang/rust CI:
I'm a little confused by the error. It almost looks like it is trying to run |
Ouch. This is a limitation of Cargo's test comparison. The output contains strings that are specific to I've cut the test down to minimum. |
Avoid testing git-specific error messages #8166
Update cargo 7 commits in 258c89644c4587273a3ed3ee9522d2640facba43..f534844c25cacc5e004404cea835ac85e35ca3fd 2020-04-30 21:48:21 +0000 to 2020-05-06 14:39:10 +0000 - Avoid testing git-specific error messages (rust-lang/cargo#8212) - features: allow activated_features_unverified to communicate not-present (rust-lang/cargo#8194) - Don't force rustc to do codegen for LTO builds (rust-lang/cargo#8192) - Hint git-fetch-with-cli on git errors (rust-lang/cargo#8166) - ¬∃x. ¬y => ∀x. y (rust-lang/cargo#8205) - clippy fixes (rust-lang/cargo#8189) - Rename bitcode-in-rlib flag to embed-bitcode (rust-lang/cargo#8204)
Our team has struggled with making Cargo git dependencies work in CI, until learning about this setting.
Cargo doesn't have a dedicated system for error hints like
rustc
, so I've stuffed the hint into the error message.