Handle exception when not in an git repository
When not in a git repository, mgmr (and I guess mkmr) will throw an exception:
Python stacktrace
Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/mkmr/instance.py", line 91, in init_repo repo = Repo(path) File "/usr/lib/python3.8/site-packages/git/repo/base.py", line 181, in __init__ raise InvalidGitRepositoryError(epath) git.exc.InvalidGitRepositoryError: /home/buildDuring handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/mkmr/instance.py", line 91, in init_repo repo = Repo(path) File "/usr/lib/python3.8/site-packages/git/repo/base.py", line 181, in init raise InvalidGitRepositoryError(epath) git.exc.InvalidGitRepositoryError: /home
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/bin/mgmr", line 33, in sys.exit(load_entry_point('mkmr==0.0.34', 'console_scripts', 'mgmr')()) File "/usr/lib/python3.8/site-packages/mkmr/mgmr.py", line 67, in main remote = Instance(options, offline=offline) File "/usr/lib/python3.8/site-packages/mkmr/instance.py", line 219, in init self.repo = init_repo() File "/usr/lib/python3.8/site-packages/mkmr/instance.py", line 95, in init_repo return init_repo(path=path.parent) File "/usr/lib/python3.8/site-packages/mkmr/instance.py", line 95, in init_repo return init_repo(path=path.parent) File "/usr/lib/python3.8/site-packages/mkmr/instance.py", line 91, in init_repo repo = Repo(path) File "/usr/lib/python3.8/site-packages/git/repo/base.py", line 181, in init raise InvalidGitRepositoryError(epath) git.exc.InvalidGitRepositoryError: /
Please handle this exception and show a nice error message.