Mercurial > kallithea
changeset 2052:320806ff6be2 beta
fixes git-protocol with
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 27 Feb 2012 07:46:52 +0200 |
parents | 6aa328b903a5 |
children | e121e10d4142 |
files | docs/changelog.rst rhodecode/lib/middleware/simplegit.py |
diffstat | 2 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/changelog.rst Mon Feb 27 05:13:40 2012 +0200 +++ b/docs/changelog.rst Mon Feb 27 07:46:52 2012 +0200 @@ -17,6 +17,7 @@ fixes +++++ +- fixed git protocol issues with repos-groups 1.3.1 (**2012-02-27**) ----------------------
--- a/rhodecode/lib/middleware/simplegit.py Mon Feb 27 05:13:40 2012 +0200 +++ b/rhodecode/lib/middleware/simplegit.py Mon Feb 27 07:46:52 2012 +0200 @@ -25,6 +25,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import os +import re import logging import traceback @@ -79,6 +80,9 @@ log = logging.getLogger(__name__) +GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs') + + def is_git(environ): """Returns True if request's target is git server. ``HTTP_USER_AGENT`` would then have git client version given. @@ -219,12 +223,16 @@ try: environ['PATH_INFO'] = self._get_by_id(environ['PATH_INFO']) repo_name = '/'.join(environ['PATH_INFO'].split('/')[1:]) + repo_name = GIT_PROTO_PAT.split(repo_name) + if repo_name: + repo_name = repo_name[0] + if repo_name.endswith('/'): repo_name = repo_name.rstrip('/') except: log.error(traceback.format_exc()) raise - repo_name = repo_name.split('/')[0] + return repo_name def __get_user(self, username):