# HG changeset patch # User Marcin Kuzminski # Date 2012-06-20 20:13:23 # Node ID 5a8c19c4dbe15880fdca19770a0066d807c3746a # Parent fddd8e3fc1579998c588a43aa67f66a7d83cf78f Fixed bug in repos group discovery, when inner folder of bare git repos were detected as a group diff --git a/rhodecode/controllers/admin/repos_groups.py b/rhodecode/controllers/admin/repos_groups.py --- a/rhodecode/controllers/admin/repos_groups.py +++ b/rhodecode/controllers/admin/repos_groups.py @@ -44,7 +44,7 @@ from rhodecode.model.repos_group import from rhodecode.model.forms import ReposGroupForm from rhodecode.model.meta import Session from rhodecode.model.repo import RepoModel -from webob.exc import HTTPInternalServerError +from webob.exc import HTTPInternalServerError, HTTPNotFound log = logging.getLogger(__name__) @@ -268,8 +268,10 @@ class ReposGroupsController(BaseControll the group by id view instead """ group_name = group_name.rstrip('/') - id_ = RepoGroup.get_by_group_name(group_name).group_id - return self.show(id_) + id_ = RepoGroup.get_by_group_name(group_name) + if id_: + return self.show(id_.group_id) + raise HTTPNotFound @HasReposGroupPermissionAnyDecorator('group.read', 'group.write', 'group.admin') diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py --- a/rhodecode/lib/utils.py +++ b/rhodecode/lib/utils.py @@ -235,6 +235,15 @@ def is_valid_repos_group(repos_group_nam if is_valid_repo(repos_group_name, base_path): return False + try: + # we need to check bare git repos at higher level + # since we might match branches/hooks/info/objects or possible + # other things inside bare git repo + get_scm(os.path.dirname(full_path)) + return False + except VCSError: + pass + # check if it's a valid path if os.path.isdir(full_path): return True