Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCredentials callback not set when pushing #437
Closed
Comments
|
OK yeah I have a patch for this, I'll open a PR on it shortly. Didn't take as long as I'd thought. I think there were a lot of authors in the file who had conflicting ideas about how the memory retain/release pattern should work for this module; I moved the callback initialization into the constructor and everything seems to work fine. Also, in general, I realized it's a good idea to wrap things that call user-supplied callbacks inside exception traps, a la
as exceptions don't propagate back through this stack trace properly:
|
|
So I understand this is fixed.. closing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@carlosmn did some hard debugging on this.
The story starts off with me writing some python code that uses libgit2. I'm creating a wrapper module around a git repo to use for append-only document storage, and I have a method in the repo that gets the "origin" remote:
After dozens of tries, I kept getting the following error when attempting a
pushoperation:_pygit2.GitError: authentication required but no callback set.After scratching my head and puzzling around with different ways to set callbacks, I jumped in to
remote.pyin pygit2, and discovered some code to set up the C callbacks infetch:I saw nothing equivalent that gets called via the
pushcode path.Looking further, I ended up debugging into libgit2 directly and checking the remote's callbacks structure that gets passed via FFI to libgit2, and found that the credentials callback on it was null.
Was this deliberate, or just an oversight? If it was just an oversight, I could take a crack at refactoring this over the weekend by extracting the callback setters into a common method in
remote.py, and ensuring that method gets called on all push/fetch operations in the file. Just wanted to check in before I blow half a weekend day on this...