-
-
Notifications
You must be signed in to change notification settings - Fork 386
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
Update to libgit2 v0.22 #459
Conversation
0106737
to
ea9b3d8
Compare
It would be awesome if the next release of pygit2 could support the new |
Sure, but that's rather outside of the scope of this PR. |
@carlosmn Oh OK sorry, I guess I misunderstood something. Why is it outside this PR's scope? |
This PR is to update pygit2. You're asking to add new features. It's already a large enough without having to worry about what's new. |
Apart from the usual API changes, we now need to introduce the concept of whether we still own the C object underneath our Repository and Remote objects. When using the custom callbacks for repository and remote creation during clone, we pass the pointer and thus ownership of the object back to the library. We will then get the repository back at the end. We return the object which was handed to us rather than opening the repository again with the local path as there is now a much higher chance that the cloned repository does not use the standard backends.
Move to use git_remote_push() instead of doing the steps ourselves. We also change to accept a list of refspecs instead of just the one refspec for the push method. As part of this, we no longer error out if the server rejected any updates, as this is a different concern from whether the push itself failed or not. We do still error out if we attempt to push non-ff updates.
We do not pass anything as the certificate, as there doesn't seem to be anything sensible for checking it.
Hi @carlosmn Now that libgit2 v0.22 has been released, do you think this PR is ready to be merged? |
Yeah, everything that changed should be working with the new version. |
The new release should be coming out soon, so let's get ready to update. This new version allows much more customisation of how remotes and repositories are created on clone, which introduced a new concept for us, namely passing ownership of remotes and repositories to the library, which is why there's
_Repository._from_c()
and_Repository._disown()
.At the moment there is on feature replacement missing: we no longer expose a boolean to ignore errors but put the handling of certificates in the hands of the programmer. This is done via passing the DER-encoded certificate, to work around the different TLS implementations.
Unfortunately, the parsing done by python's
ssl
module is deep in C code and expects us to have set up a connection via OpenSSL wrapping some socket. But all we can assume is that we're have a buffer with the certificate. If anybody knows of some python module to parse such a buffer, I'd love to know. Everything I've been able to find is either going down to the ASN.1 level or rather incomplete.