changeset 6005:81ff11476d16

git: make sure repository path and name are Unicode strings This is needed for supporting latest Dulwich version, but it also works with out supported version.
author Andrew Shadura <andrew@shadura.me>
date Tue, 12 Jul 2016 21:47:14 +0200
parents c9f97be1927e
children b5859022ac69
files kallithea/lib/hooks.py kallithea/lib/middleware/pygrack.py kallithea/lib/middleware/simplegit.py kallithea/lib/vcs/backends/git/repository.py
diffstat 4 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/hooks.py	Tue Jul 12 21:47:14 2016 +0200
+++ b/kallithea/lib/hooks.py	Tue Jul 12 21:47:14 2016 +0200
@@ -35,7 +35,7 @@
 from kallithea.lib.utils import action_logger
 from kallithea.lib.vcs.backends.base import EmptyChangeset
 from kallithea.lib.exceptions import HTTPLockedRC, UserCreationError
-from kallithea.lib.utils2 import safe_str, _extract_extras
+from kallithea.lib.utils2 import safe_str, safe_unicode, _extract_extras
 from kallithea.model.db import Repository, User
 
 
@@ -390,6 +390,7 @@
     from kallithea.lib.utils import make_ui
     extras = _extract_extras(env)
 
+    repo_path = safe_unicode(repo_path)
     path, ini_name = os.path.split(extras['config'])
     conf = appconfig('config:%s' % ini_name, relative_to=path)
     load_environment(conf.global_conf, conf.local_conf, test_env=False,
--- a/kallithea/lib/middleware/pygrack.py	Tue Jul 12 21:47:14 2016 +0200
+++ b/kallithea/lib/middleware/pygrack.py	Tue Jul 12 21:47:14 2016 +0200
@@ -34,6 +34,7 @@
 
 import kallithea
 from kallithea.lib.vcs import subprocessio
+from kallithea.lib.utils2 import safe_unicode
 
 log = logging.getLogger(__name__)
 
@@ -86,6 +87,7 @@
 
         :param path:
         """
+        path = safe_unicode(path)
         assert path.startswith('/' + self.repo_name + '/')
         return path[len(self.repo_name) + 2:].strip('/')
 
--- a/kallithea/lib/middleware/simplegit.py	Tue Jul 12 21:47:14 2016 +0200
+++ b/kallithea/lib/middleware/simplegit.py	Tue Jul 12 21:47:14 2016 +0200
@@ -227,7 +227,7 @@
         from kallithea.lib.middleware.pygrack import make_wsgi_app
         app = make_wsgi_app(
             repo_root=safe_str(self.basepath),
-            repo_name=repo_name,
+            repo_name=safe_unicode(repo_name),
             extras=extras,
         )
         return app
--- a/kallithea/lib/vcs/backends/git/repository.py	Tue Jul 12 21:47:14 2016 +0200
+++ b/kallithea/lib/vcs/backends/git/repository.py	Tue Jul 12 21:47:14 2016 +0200
@@ -58,7 +58,7 @@
     def __init__(self, repo_path, create=False, src_url=None,
                  update_after_clone=False, bare=False):
 
-        self.path = abspath(repo_path)
+        self.path = safe_unicode(abspath(repo_path))
         repo = self._get_repo(create, src_url, update_after_clone, bare)
         self.bare = repo.bare