changeset 2872:17556a81ec6f beta

Make detecting bare Git repositories more robust Git remote repositories may end on '.git', e.g. myrepo.git. Just checking for a repository path to end on '.git' causes 'Repository not found' errors in such a case. To distinguish between bare and normal Git repositories, check if there is a '/.git' part at the end of the repository path (i.e. if GIT_DIR is pointing to '.' (bare) or '.git').
author Stefan Engel <mail@engel-stefan.de>
date Tue, 25 Sep 2012 21:11:23 +0200
parents b54d1024d9ea
children b1b31bfe2f99
files rhodecode/lib/hooks.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/hooks.py	Wed Sep 26 21:25:40 2012 +0200
+++ b/rhodecode/lib/hooks.py	Tue Sep 25 21:11:23 2012 +0200
@@ -328,8 +328,8 @@
 
     baseui = make_ui('db')
     # fix if it's not a bare repo
-    if repo_path.endswith('.git'):
-        repo_path = repo_path[:-4]
+    if repo_path.endswith(os.sep + '.git'):
+        repo_path = repo_path[:-5]
 
     repo = Repository.get_by_full_path(repo_path)
     if not repo: