checking to see if diffFile is a submodule.
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
Is there a way to check to see if a diffFile is a submodule?
The repo that I'm getting my diff deltas from is bare so there's no working directory for Repository.lookup_submodule(path) or Repository.listall_submodules() to work with.
The main issue is when I try to get an added file via something like:
new_file = git_repo[delta.new_file.id]
I get the following key error.
Traceback (most recent call last):
File "/Users/user/project/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/user/project/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/user/project/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/user/project/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/user/project/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/Users/user/project/repos/views.py", line 105, in get
new_file = git_repo[delta.new_file.id]
File "/Users/user/project/venv/lib/python3.7/site-packages/pygit2/repository.py", line 121, in __getitem__
raise KeyError(key)
KeyError: ffeef8955335d0ec95f23c2fd75821672cf14bb9
If it's a submodule I don't need the contents. I just need to know that it's a submodule. Is there a general way to do this?
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 damit, die Verarbeitung rund um delta.new_file.id sowie die APIs Repository.lookup_submodule(path) und Repository.listall_submodules() zu lesen, insbesondere für bare repositories. Prüfe, wie ein Diff-Eintrag ein Submodul identifiziert, ohne dessen Inhalte zu laden. Erledigt ist die Aufgabe, wenn eine zuverlässige Möglichkeit dokumentiert oder bereitgestellt ist, Submodul-Einträge vor der Indexierung des Repositorys zu unterscheiden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- git, python
- Bereich
- devtools
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100