changeset 2327:69b836e383df beta

don't disable .git directory for bare repos on deleting, ref #413
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 22 May 2012 20:35:54 +0200
parents 405b1170f577
children d3f1b71099ab f16fc10ac78d
files rhodecode/model/repo.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/model/repo.py	Tue May 22 20:23:30 2012 +0200
+++ b/rhodecode/model/repo.py	Tue May 22 20:35:54 2012 +0200
@@ -493,10 +493,15 @@
         """
         rm_path = os.path.join(self.repos_path, repo.repo_name)
         log.info("Removing %s" % (rm_path))
-        # disable hg/git
+        # disable hg/git internal that it doesn't get detected as repo
         alias = repo.repo_type
-        shutil.move(os.path.join(rm_path, '.%s' % alias),
-                    os.path.join(rm_path, 'rm__.%s' % alias))
+
+        bare = getattr(repo.scm_instance, 'bare', False)
+
+        if not bare:
+            # skip this for bare git repos
+            shutil.move(os.path.join(rm_path, '.%s' % alias),
+                        os.path.join(rm_path, 'rm__.%s' % alias))
         # disable repo
         _d = 'rm__%s__%s' % (datetime.now().strftime('%Y%m%d_%H%M%S_%f'),
                              repo.repo_name)