diff --git a/rhodecode/lib/middleware/simplevcs.py b/rhodecode/lib/middleware/simplevcs.py --- a/rhodecode/lib/middleware/simplevcs.py +++ b/rhodecode/lib/middleware/simplevcs.py @@ -230,7 +230,8 @@ class SimpleVCS(object): repo_name, db_repo.repo_type, scm_type) return False - return is_valid_repo(repo_name, base_path, explicit_scm=scm_type) + return is_valid_repo(repo_name, base_path, + explicit_scm=scm_type, expect_scm=scm_type) def valid_and_active_user(self, user): """ diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py --- a/rhodecode/lib/utils.py +++ b/rhodecode/lib/utils.py @@ -260,7 +260,7 @@ def is_valid_repo(repo_name, base_path, try: if explicit_scm: - detected_scms = [get_scm_backend(explicit_scm)] + detected_scms = [get_scm_backend(explicit_scm)(full_path).alias] else: detected_scms = get_scm(full_path) diff --git a/rhodecode/tests/other/vcs_operations/test_vcs_operations.py b/rhodecode/tests/other/vcs_operations/test_vcs_operations.py --- a/rhodecode/tests/other/vcs_operations/test_vcs_operations.py +++ b/rhodecode/tests/other/vcs_operations/test_vcs_operations.py @@ -39,6 +39,7 @@ from rhodecode.lib.vcs.nodes import File from rhodecode.model.auth_token import AuthTokenModel from rhodecode.model.db import Repository, UserIpMap, CacheKey from rhodecode.model.meta import Session +from rhodecode.model.repo import RepoModel from rhodecode.model.user import UserModel from rhodecode.tests import (GIT_REPO, HG_REPO, TEST_USER_ADMIN_LOGIN) @@ -177,6 +178,28 @@ class TestVCSOperations(object): 'git clone', clone_url, tmpdir.strpath) assert 'not found' in stderr + def test_clone_non_existing_store_path_hg(self, rc_web_server, tmpdir, user_util): + repo = user_util.create_repo() + clone_url = rc_web_server.repo_clone_url(repo.repo_name) + + # Damage repo by removing it's folder + RepoModel()._delete_filesystem_repo(repo) + + stdout, stderr = Command('/tmp').execute( + 'hg clone', clone_url, tmpdir.strpath) + assert 'HTTP Error 404: Not Found' in stderr + + def test_clone_non_existing_store_path_git(self, rc_web_server, tmpdir, user_util): + repo = user_util.create_repo(repo_type='git') + clone_url = rc_web_server.repo_clone_url(repo.repo_name) + + # Damage repo by removing it's folder + RepoModel()._delete_filesystem_repo(repo) + + stdout, stderr = Command('/tmp').execute( + 'git clone', clone_url, tmpdir.strpath) + assert 'not found' in stderr + def test_push_new_file_hg(self, rc_web_server, tmpdir): clone_url = rc_web_server.repo_clone_url(HG_REPO) stdout, stderr = Command('/tmp').execute(