-
Notifications
You must be signed in to change notification settings - Fork 392
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
Add git_libgit2_opts binding for get/set search path #656
Conversation
9d49f98
to
b741fbd
Compare
Not sure how to handle path on Windows. Should Lines 91 to 95 in 6880563
|
Also, ccb48dd makes it thread-safe to access global state of search path, but have no idea is that necessary. |
0075b12
to
ccb48dd
Compare
d7c8fd0
to
e5d8643
Compare
e5d8643 fix: get_search_path will returns CString I think returning a |
This seems generally fine but the global-state-ness is worrisome with respect to how this is being used in rust-lang/cargo#9035. If this doesn't work for that PR would you still like to land this? |
If i didn't get it wrong, from the view of git2-rs itself, the global state in git2-rs just reflects the global state in libgit2. To make git2-rs as safe as possible (that's one of it's goal 😂), I would choose an approach similar to this one no matter how callers use it. |
Ok, in that case though I think it may be better to flag these functions as |
Got it. I'll remove the synchronization part. Thanks! |
Looks good! As one final thing though, I think the test may wantt to move to an integration test in something like |
Thanks for your advice. The test has been moved to a integration test at adc0ee8. I have a dumb question to task. If I understand it correctly, the reason moving it to a integration test is that if people what to mutate the same global state, it can edit the "integration test" directly without touching "unit test" part, right? |
👍 |
Fix: set default git config search path for tests 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 😄
Prepare these bindings in order to fix rust-lang/cargo#8863.
Due to the same reason mentioned #126 (comment) , the bindings do not split strings to paths and leave the work for callers to call
std::env::join_paths
themselves.