##// END OF EJS Templates
git: make sure we don't break streaming in case of empty pull messages....
marcink -
r277:90be8c49 stable
parent child Browse files
Show More
@@ -229,7 +229,7 b' class GitRepository(object):'
229 229 def _inject_messages_to_response(self, response, capabilities,
230 230 start_messages, end_messages):
231 231 """
232 Given a list reponse we inject the pre/post-pull messages.
232 Given a list response we inject the pre/post-pull messages.
233 233
234 234 We only inject the messages if the client supports sideband, and the
235 235 response has the format:
@@ -241,13 +241,18 b' class GitRepository(object):'
241 241 if not self.SIDE_BAND_CAPS.intersection(capabilities):
242 242 return response
243 243
244 if not start_messages and not end_messages:
245 return response
246
247 # make a list out of response if it's an iterator
248 # so we can investigate it for message injection.
249 if hasattr(response, '__iter__'):
250 response = list(response)
251
244 252 if (not response[0].startswith('0008NAK\n') or
245 253 not response[-1].endswith('0000')):
246 254 return response
247 255
248 if not start_messages and not end_messages:
249 return response
250
251 256 new_response = ['0008NAK\n']
252 257 new_response.extend(self._get_messages(start_messages, capabilities))
253 258 if len(response) == 1:
@@ -303,6 +308,7 b' class GitRepository(object):'
303 308 git_command.encode('utf8'))
304 309 resp.charset = None
305 310
311 pre_pull_messages = ''
306 312 if git_command == 'git-upload-pack':
307 313 status, pre_pull_messages = hooks.git_pre_pull(self.extras)
308 314 if status != 0:
@@ -352,7 +358,6 b' class GitRepository(object):'
352 358 pass
353 359
354 360 if git_command == 'git-upload-pack':
355 out = list(out)
356 361 unused_status, post_pull_messages = hooks.git_post_pull(self.extras)
357 362 resp.app_iter = self._inject_messages_to_response(
358 363 out, capabilities, pre_pull_messages, post_pull_messages)
General Comments 0
You need to be logged in to leave comments. Login now