changeset 2320:48d93ea1e245 beta

fixed issues with support of bare-repos by vcs lib
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 21 May 2012 20:41:15 +0200
parents 4c239e0dcbb7
children 75280665ad1e
files rhodecode/lib/vcs/backends/git/repository.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/vcs/backends/git/repository.py	Sun May 20 16:38:00 2012 +0200
+++ b/rhodecode/lib/vcs/backends/git/repository.py	Mon May 21 20:41:15 2012 +0200
@@ -66,6 +66,7 @@
                 'config'),
             abspath(get_user_home(), '.gitconfig'),
         ]
+        self.bare = self._repo.bare
 
     @LazyProperty
     def revisions(self):
@@ -226,9 +227,10 @@
         try:
             return time.mktime(self.get_changeset().date.timetuple())
         except RepositoryError:
+            idx_loc = '' if self.bare else '.git'
             # fallback to filesystem
-            in_path = os.path.join(self.path, '.git', "index")
-            he_path = os.path.join(self.path, '.git', "HEAD")
+            in_path = os.path.join(self.path, idx_loc, "index")
+            he_path = os.path.join(self.path, idx_loc, "HEAD")
             if os.path.exists(in_path):
                 return os.stat(in_path).st_mtime
             else:
@@ -236,8 +238,9 @@
 
     @LazyProperty
     def description(self):
+        idx_loc = '' if self.bare else '.git'
         undefined_description = u'unknown'
-        description_path = os.path.join(self.path, '.git', 'description')
+        description_path = os.path.join(self.path, idx_loc, 'description')
         if os.path.isfile(description_path):
             return safe_unicode(open(description_path).read())
         else: