##// END OF EJS Templates
merge pull request #32 from codingtony
marcink -
r2061:9f0fe677 beta
parent child Browse files
Show More
@@ -20,7 +20,7 b' fixes'
20 20 - fixed git protocol issues with repos-groups
21 21 - fixed git remote repos validator that prevented from cloning remote git repos
22 22 - fixes #370 ending slashes fixes for repo and groups
23 #- fixes #368 improved git-protocol detection to handle other clients
23 - fixes #368 improved git-protocol detection to handle other clients
24 24 - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be
25 25 Moved To Root
26 26
@@ -80,24 +80,20 b' from webob.exc import HTTPNotFound, HTTP'
80 80 log = logging.getLogger(__name__)
81 81
82 82
83 GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs')
83 GIT_PROTO_PAT = re.compile(r'^/(.+)/(info/refs|git-upload-pack|git-receive-pack)')
84 84
85 85
86 86 def is_git(environ):
87 """Returns True if request's target is git server.
88 ``HTTP_USER_AGENT`` would then have git client version given.
89
90 :param environ:
91 """
92 http_user_agent = environ.get('HTTP_USER_AGENT')
93 if http_user_agent and http_user_agent.startswith('git'):
94 return True
95 return False
87 path_info = environ['PATH_INFO']
88 isgit_path = GIT_PROTO_PAT.match(path_info)
89 log.debug('is a git path %s pathinfo : %s' % (isgit_path, path_info))
90 return isgit_path
96 91
97 92
98 93 class SimpleGit(BaseVCSController):
99 94
100 95 def _handle_request(self, environ, start_response):
96
101 97 if not is_git(environ):
102 98 return self.application(environ, start_response)
103 99
@@ -222,13 +218,7 b' class SimpleGit(BaseVCSController):'
222 218 """
223 219 try:
224 220 environ['PATH_INFO'] = self._get_by_id(environ['PATH_INFO'])
225 repo_name = '/'.join(environ['PATH_INFO'].split('/')[1:])
226 repo_name = GIT_PROTO_PAT.split(repo_name)
227 if repo_name:
228 repo_name = repo_name[0]
229
230 if repo_name.endswith('/'):
231 repo_name = repo_name.rstrip('/')
221 repo_name = GIT_PROTO_PAT.match(environ['PATH_INFO']).group(1)
232 222 except:
233 223 log.error(traceback.format_exc())
234 224 raise
@@ -239,8 +229,7 b' class SimpleGit(BaseVCSController):'
239 229 return User.get_by_username(username)
240 230
241 231 def __get_action(self, environ):
242 """
243 Maps git request commands into a pull or push command.
232 """Maps git request commands into a pull or push command.
244 233
245 234 :param environ:
246 235 """
General Comments 0
You need to be logged in to leave comments. Login now