Skip to content
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

AttributeError: cffi library 'pygit2._libgit2' has no function, constant or global variable named 'git_remote_save' #1219

Open
mmulich opened this issue Jun 25, 2023 · 1 comment

Comments

@mmulich
Copy link

mmulich commented Jun 25, 2023

I've installed using pip install pygit2==1.12.1. The environment is a python:3.10 docker container.

I'm receiving:

Traceback (most recent call last):
  ...
  File "...", line 197, in pull_repo
    remote.save()
  File "/app/env/lib/python3.10/site-packages/pygit2/remote.py", line 117, in save
    err = C.git_remote_save(self._remote)
AttributeError: cffi library 'pygit2._libgit2' has no function, constant or global variable named 'git_remote_save'. Did you mean: 'git_remote_name'?

The relevant code associated with this error is as follows:

repo = pygit2.Repository(checkout_location)
remote = repo.remotes['origin']
remote.fetch(callbacks=callbacks)
remote.save()

I attempted to use the Remote.save method because the call to Remote.fetch didn't appear to do anything to the repository, which is known to have changed.

Note, I could be using this all wrong, but I would still think an AttributeError shouldn't be raised. Also, there isn't a good example or clear way to do the equivalent of a git pull, which is why I'm fiddling with fetching the remote in order to advance the index.

jdavid added a commit that referenced this issue Jun 25, 2023
@jdavid
Copy link
Member

jdavid commented Jun 25, 2023

Good catch, the method was added in 2014 but libgit2 removed git_remote_save in 2015 (v0.23). There was not a unit test for it so it went unnoticed. This is what the changelog of libgit2 says:

git_remote_save() and git_remote_clear_refspecs() have been
removed. Remote's configuration is changed via the configuration
directly or through a convenience function which performs changes to
the configuration directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants