0

I'm working on porting some python2 code to python3 - single codebase. I'm using pygit2 0.28.2 on cpython 2.7, and pygit2 1.9.2 on cpython3.10, at least for now.

I'm getting an error (-3) back from:

err = C.git_remote_push(self._remote, refspecs, opts)

...and payload.check_error(err) is mapping that to:

KeyError: 'the requested type does not match the type in the ODB'

That error only surfaces on cpython3.10, not cpython2.7.

I'm afraid I don't know what to make of the error. I googled for about 90 minutes, and didn't find much.

Here's the full traceback:

Traceback (most recent call last):
    File "/app/shared/common/git/handlers.py", line 488, in Push
        remote.push(temp3, callbacks=self.callbacks)
    File "/usr/local/lib/python3.10/site-packages/pygit2/remote.py", line 257, in push
        payload.check_error(err)
    File "/usr/local/lib/python3.10/site-packages/pygit2/callbacks.py", line 93, in check_error
        check_error(error_code)
    File "/usr/local/lib/python3.10/site-packages/pygit2/errors.py", line 56, in check_error
        raise KeyError(message)'
KeyError: 'the requested type does not match the type in the ODB'

Can anyone please give me a nudge in the right direction? What types is it complaining about? To pygit2, the data passed appears to be pretty opaque.

Is it possible that pygit2 0.28.2 would 'force' always, while pygit2 1.9.2 will only force by request? We've got libgit2's "strict mode" turned off in Python 3.

Thanks!

dstromberg
  • 6,954
  • 1
  • 26
  • 27

1 Answers1

0

It turned out that pygit2 0.28.2 works, if we Start with 0.28.2. If we start with something later, like 1.5.0 and manually switch back to 0.28.2, the damage has already been done to the git repo, causing 0.28.2 to give errors too.

There are likely (somewhat) later versions that are happy as well, but that's another story.

dstromberg
  • 6,954
  • 1
  • 26
  • 27