-
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: set default git config search path for tests #9035
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
13fcd2e
to
b8e9a20
Compare
Thanks for the PR! I don't think this is the correct solution, however, because each thread has its own unique search path, right? The libgit2 search path is a global configuration option so if all threads are always changing it then I don't think that it is guaranteed to be configured correctly for each test? |
My fault. I didn't notice that 😅. The original goal is to prevent global configurations from affecting tests. What if we set the search path to nowhere (maybe a empty directory?) and let git configs keep the defaults? |
That seems reasonable to me, yeah, having a sort of one-time configuration which points it to a blank location. |
b8e9a20
to
e5854a4
Compare
crates/cargo-test-support/src/git.rs
Outdated
fn default_search_path() { | ||
use crate::paths::GLOBAL_ROOT; | ||
use git2::{opts::set_search_path, ConfigLevel}; | ||
lazy_static::lazy_static! { |
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.
FWIW instead of using lazy_static
this can use a sync::sync::Once
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.
Fixed. Thanks!
This pull request is almost ready for review. Is there any plan to rollout a new release of git2?
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.
Sure yeah, I just published a new version.
4a47774
to
86be6d4
Compare
35e2277
to
332887e
Compare
Since git2-rs#0.13.16 is released. This pull request is now ready for review. |
Thanks! Could this bump the version requirement on |
@bors: r+ |
📌 Commit 06d65a4 has been approved by |
☀️ Test successful - checks-actions |
Update cargo 7 commits in 783bc43c660bf39c1e562c8c429b32078ad3099b..c3abcfe8a75901c7c701557a728941e8fb19399e 2021-01-20 19:02:26 +0000 to 2021-01-25 16:16:43 +0000 - Minor update to tracking issue template. (rust-lang/cargo#9097) - Add some extra help to `cargo new` and invalid package names. (rust-lang/cargo#9098) - Fix compilation with serde 1.0.122 (rust-lang/cargo#9102) - Add suggestion for bad package id. (rust-lang/cargo#9095) - Remove Registry::new. (rust-lang/cargo#9093) - Fix: set default git config search path for tests (rust-lang/cargo#9035) - Unstable updates (rust-lang/cargo#9092)
Fixes #8863 by setting the default config search path.
Just wait rust-lang/git2-rs#656 being merged and update Cargo.toml the new release of git2-rs 😄