rust-lang / git2-rs

libgit2 bindings for Rust
https://docs.rs/git2
Apache License 2.0
1.69k stars 387 forks source link

Add binding for GIT_OPT_SET_SSL_CERT_LOCATIONS #997

Closed aharbis closed 11 months ago

aharbis commented 11 months ago

Adds a binding for git_libgit2_opts key GIT_OPT_SET_SSL_CERT_LOCATIONS in opts module.

https://github.com/rust-lang/git2-rs/issues/995

ehuss commented 11 months ago

Thanks! I was wondering, instead of surfacing the kinda weird low-level API (which looks to be inherited from OpenSSL's SSL_CTX_load_verify_locations) if it could have something that is a little more explicit that doesn't require the use of Option. Perhaps something like separate functions:

pub unsafe fn set_ssl_cert_file<P: IntoCString>(file: P) -> Result<(), Error>
pub unsafe fn set_ssl_cert_dir<P: IntoCString>(path: P) -> Result<(), Error>

That way it is a little clearer and more deliberate as to what the caller is doing. WDYT?

aharbis commented 11 months ago

@ehuss Good idea, I've updated the PR with the proposed change.