git: use bool condition to check if the git path is fine. Using exceptions
spams the logs with confusing tracebacks.
This commit is contained in:
parent
81d17e2b3f
commit
fad0fcf1c3
3 changed files with 7 additions and 3 deletions
|
|
@ -163,7 +163,11 @@ class GitRepository(BaseRepository):
|
|||
else:
|
||||
self._remote.init()
|
||||
else:
|
||||
self._remote.assert_correct_path()
|
||||
if not self._remote.assert_correct_path():
|
||||
raise RepositoryError(
|
||||
'Path "%s" does not contain a Git repository' %
|
||||
(self.path,))
|
||||
|
||||
# TODO: johbo: check if we have to translate the OSError here
|
||||
except OSError as err:
|
||||
raise RepositoryError(err)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class TestGitRepository:
|
|||
return GitRepository(next(REPO_PATH_GENERATOR), create=True, bare=bare)
|
||||
|
||||
def test_wrong_repo_path(self):
|
||||
wrong_repo_path = '/tmp/errorrepo'
|
||||
wrong_repo_path = '/tmp/errorrepo_git'
|
||||
with pytest.raises(RepositoryError):
|
||||
GitRepository(wrong_repo_path)
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class TestMercurialRepository:
|
|||
return MercurialRepository(next(REPO_PATH_GENERATOR), create=True)
|
||||
|
||||
def test_wrong_repo_path(self):
|
||||
wrong_repo_path = '/tmp/errorrepo'
|
||||
wrong_repo_path = '/tmp/errorrepo_hg'
|
||||
with pytest.raises(RepositoryError):
|
||||
MercurialRepository(wrong_repo_path)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue