InvalidSpecError for `repo.checkout("rev")` when `git checkout rev` works fine
Offen
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 1.7k
- Forks
- 408
- Ø Merge
- 2 T. 57 Min.
- Gemergte PRs (30 T.)
- 7
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne bei pygit2/repository.py rund um die Checkout-Implementierung und reproduziere das bereitgestellte commit-hash-Beispiel. Vergleiche, wie die Python-Bindung das Argument auflöst, mit dem von git checkout erwarteten Verhalten; abgeschlossen ist die Aufgabe, wenn der gezeigte commit hash von repo.checkout ohne InvalidSpecError akzeptiert wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- git, python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100