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

InvalidSpecError for repo.checkout("rev") when git checkout rev works fine #1217

Open
AdamWill opened this issue Jun 1, 2023 · 1 comment

Comments

@AdamWill
Copy link

AdamWill commented Jun 1, 2023

To reproduce:

git clone https://src.fedoraproject.org/rpms/python-pymongo.git
cd python-pymongo
python3
>>> import pygit2
>>> pyrepo = pygit2.Repository("./")
>>> pyrepo.checkout("a3432e746082d0c96811cbf87aa7ae8e7fe62bc8")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.11/site-packages/pygit2/repository.py", line 420, in checkout
    reference = self.lookup_reference(refname)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_pygit2.InvalidSpecError: a3432e746082d0c96811cbf87aa7ae8e7fe62bc8: the given reference name 'a3432e746082d0c96811cbf87aa7ae8e7fe62bc8' is not valid
>>> (ctrl-d)
[adamw@xps13a python-pymongo (rawhide)]$ git checkout a3432e746082d0c96811cbf87aa7ae8e7fe62bc8
Note: switching to 'a3432e746082d0c96811cbf87aa7ae8e7fe62bc8'.
[...]
HEAD is now at a3432e7 Update to 3.4.0 (#1400227).

so, checkout of that commit works fine with git checkout but not pygit2 checkout. I've no idea why not. Not sure if this is a pygit2 or libgit2 issue.

@AdamWill AdamWill changed the title InvalidSpecError for repo.checkout("hash") when git checkout hash works fine InvalidSpecError for repo.checkout("rev") when git checkout rev works fine Jun 1, 2023
@AdamWill
Copy link
Author

AdamWill commented Jun 1, 2023

This is with pygit2 1.12.0 and libgit2 1.6.4.

RobotSail pushed a commit to RobotSail/commitfinder that referenced this issue Nov 10, 2023
Sometimes it does, inexplicably.
libgit2/pygit2#1217

Signed-off-by: Adam Williamson <awilliam@redhat.com>
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

1 participant