diff --git a/rhodecode/lib/vcs/backends/git/repository.py b/rhodecode/lib/vcs/backends/git/repository.py --- a/rhodecode/lib/vcs/backends/git/repository.py +++ b/rhodecode/lib/vcs/backends/git/repository.py @@ -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) diff --git a/rhodecode/tests/vcs/test_git.py b/rhodecode/tests/vcs/test_git.py --- a/rhodecode/tests/vcs/test_git.py +++ b/rhodecode/tests/vcs/test_git.py @@ -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) diff --git a/rhodecode/tests/vcs/test_hg.py b/rhodecode/tests/vcs/test_hg.py --- a/rhodecode/tests/vcs/test_hg.py +++ b/rhodecode/tests/vcs/test_hg.py @@ -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)