Show More
@@ -2,6 +2,7 b' import os' | |||||
2 | import socket |
|
2 | import socket | |
3 | import logging |
|
3 | import logging | |
4 | import subprocess |
|
4 | import subprocess | |
|
5 | import traceback | |||
5 |
|
6 | |||
6 | from webob import Request, Response, exc |
|
7 | from webob import Request, Response, exc | |
7 |
|
8 | |||
@@ -90,7 +91,7 b' class GitRepository(object):' | |||||
90 | ] |
|
91 | ] | |
91 | ) |
|
92 | ) | |
92 | except EnvironmentError, e: |
|
93 | except EnvironmentError, e: | |
93 | log.exception(e) |
|
94 | log.error(traceback.format_exc()) | |
94 | raise exc.HTTPExpectationFailed() |
|
95 | raise exc.HTTPExpectationFailed() | |
95 | resp = Response() |
|
96 | resp = Response() | |
96 | resp.content_type = 'application/x-%s-advertisement' % str(git_command) |
|
97 | resp.content_type = 'application/x-%s-advertisement' % str(git_command) | |
@@ -126,23 +127,25 b' class GitRepository(object):' | |||||
126 | env=gitenv, |
|
127 | env=gitenv, | |
127 | cwd=os.getcwd() |
|
128 | cwd=os.getcwd() | |
128 | ) |
|
129 | ) | |
129 |
|
130 | cmd = r'git %s --stateless-rpc "%s"' % (git_command[4:], | ||
|
131 | self.content_path), | |||
|
132 | log.debug('handling cmd %s' % cmd) | |||
130 | out = subprocessio.SubprocessIOChunker( |
|
133 | out = subprocessio.SubprocessIOChunker( | |
131 | r'git %s --stateless-rpc "%s"' % (git_command[4:], |
|
134 | cmd, | |
132 | self.content_path), |
|
|||
133 | inputstream=inputstream, |
|
135 | inputstream=inputstream, | |
134 | **opts |
|
136 | **opts | |
135 | ) |
|
137 | ) | |
136 | except EnvironmentError, e: |
|
138 | except EnvironmentError, e: | |
137 | log.exception(e) |
|
139 | log.error(traceback.format_exc()) | |
138 | raise exc.HTTPExpectationFailed() |
|
140 | raise exc.HTTPExpectationFailed() | |
139 |
|
141 | |||
140 | if git_command in [u'git-receive-pack']: |
|
142 | if git_command in [u'git-receive-pack']: | |
141 | # updating refs manually after each push. |
|
143 | # updating refs manually after each push. | |
142 | # Needed for pre-1.7.0.4 git clients using regular HTTP mode. |
|
144 | # Needed for pre-1.7.0.4 git clients using regular HTTP mode. | |
143 |
|
|
145 | cmd = (u'git --git-dir "%s" ' | |
144 |
|
|
146 | 'update-server-info' % self.content_path) | |
145 | shell=True) |
|
147 | log.debug('handling cmd %s' % cmd) | |
|
148 | subprocess.call(cmd, shell=True) | |||
146 |
|
149 | |||
147 | resp = Response() |
|
150 | resp = Response() | |
148 | resp.content_type = 'application/x-%s-result' % git_command.encode('utf8') |
|
151 | resp.content_type = 'application/x-%s-result' % git_command.encode('utf8') | |
@@ -161,9 +164,9 b' class GitRepository(object):' | |||||
161 | resp = app(request, environ) |
|
164 | resp = app(request, environ) | |
162 | except exc.HTTPException, e: |
|
165 | except exc.HTTPException, e: | |
163 | resp = e |
|
166 | resp = e | |
164 | log.exception(e) |
|
167 | log.error(traceback.format_exc()) | |
165 | except Exception, e: |
|
168 | except Exception, e: | |
166 | log.exception(e) |
|
169 | log.error(traceback.format_exc()) | |
167 | resp = exc.HTTPInternalServerError() |
|
170 | resp = exc.HTTPInternalServerError() | |
168 | return resp(environ, start_response) |
|
171 | return resp(environ, start_response) | |
169 |
|
172 |
General Comments 0
You need to be logged in to leave comments.
Login now