Implement (almost) all global options#1409
Merged
jdavid merged 9 commits intolibgit2:masterfrom Aug 13, 2025
Merged
Conversation
ambv
commented
Aug 11, 2025
|
|
||
| __array: 'GitStrrayC | ffi.NULL_TYPE' | ||
| __strings: list['None | ArrayC[char]'] | ||
| __arr: 'ArrayC[char]' |
Contributor
Author
There was a problem hiding this comment.
A strarray is an array of strings, not a single string.
ambv
commented
Aug 11, 2025
| tar xf $FILENAME.tar.gz | ||
| cd $FILENAME | ||
| mkdir build -p | ||
| mkdir -p build |
Contributor
Author
There was a problem hiding this comment.
Otherwise this fails on macOS where mkdir doesn't use the GNU version.
Contributor
Author
|
I can reproduce the openssl segfault on Ubuntu with: So far I had a test with a dummy cert there, which looks like it's harmful. Let me adjust this one test to add an actual cert. |
Contributor
Author
|
It turns out GIT_OPT_ADD_SSL_X509_CERT doesn't accept a byte stream of the cert, but instead expects a pointer to an OpenSSL X509 struct. Since I don't want to make pygit2 directly dependent on OpenSSL, I decided to skip support GIT_OPT_ADD_SSL_X509_CERT in this PR. After all, we can use GIT_OPT_SET_SSL_CERT_LOCATIONS instead. |
Member
|
Thanks! |
This was referenced Oct 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request is split into two commits, doing those things:
Commit 1: moves option handling from the Python C API to CFFI
This simplifies future edits and removes some static typing weirdness around the
_pygit2.pyifile needing Python-level enums to express the C-level functional API.Mostly, this moves pygit2 in the direction of being more CFFI, which will eventually lead to beautiful things like not needing to push new wheels every time a new version of Python comes out (i.e. #1046).
This diff is actually red (more lines removed than added).
Commit 2: implements all remaining options
...save for
GIT_OPT_SET_ALLOCATOR, which I'm pretty confident is useless for Python users, and next to impossible to get right.[edit] ...and for
GIT_OPT_ADD_SSL_X509_CERT, which would make pygit2 dependent on OpenSSL since it requires calling OpenSSL APIs directly.But other options that were missing so far are handled, including three network related that I was really looking forward to:
SET_SERVER_TIMEOUT,SET_SERVER_CONNECT_TIMEOUT, andENABLE_HTTP_EXPECT_CONTINUE.All new options have a corresponding test.