changeset 2497:5a8c19c4dbe1 beta

Fixed bug in repos group discovery, when inner folder of bare git repos were detected as a group
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 20 Jun 2012 22:13:23 +0200
parents fddd8e3fc157
children 9989d727ef1b
files rhodecode/controllers/admin/repos_groups.py rhodecode/lib/utils.py
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/admin/repos_groups.py	Wed Jun 20 21:42:05 2012 +0200
+++ b/rhodecode/controllers/admin/repos_groups.py	Wed Jun 20 22:13:23 2012 +0200
@@ -44,7 +44,7 @@
 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 @@
         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')
--- a/rhodecode/lib/utils.py	Wed Jun 20 21:42:05 2012 +0200
+++ b/rhodecode/lib/utils.py	Wed Jun 20 22:13:23 2012 +0200
@@ -235,6 +235,15 @@
     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