-
-
Notifications
You must be signed in to change notification settings - Fork 404
Closed
Description
When I try to open a Repository
using a path that doesn't actually contain a Git repo, the error is a very non-specific KeyError
:
>>> print(pygit2.__version__)
0.24.1
>>> os.mkdir('/tmp/foobarbaz')
>>> gitrepo=pygit2.Repository('/tmp/foobarbaz')
Traceback (most recent call last):
File "<ipython-input-30-782283f588bb>", line 1, in <module>
gitrepo=pygit2.Repository('/tmp/foobarbaz')
File "/usr/local/lib/python2.7/dist-packages/pygit2/repository.py", line 64, in __init__
super(Repository, self).__init__(path, *args, **kwargs)
KeyError: '/tmp/foobarbaz'
It would be helpful to replace this with a more specific GitError
, so that the error from Git can be distinguished from a "normal" KeyError
in a statement like this:
>>> repos = { "repo1":"/path/to/repo1", "repo2":"/path/to/repo2" }
>>> gitrepo = pygit2.Repository( repos["repo3"] )
Metadata
Metadata
Assignees
Labels
No labels