Chromium Code Reviews| Index: git_cl/git_cl.py |
| =================================================================== |
| --- git_cl/git_cl.py (revision 72285) |
| +++ git_cl/git_cl.py (working copy) |
| @@ -668,8 +668,18 @@ |
| hook = '%s/%s' % (settings.GetRoot(), hook) |
| if not os.path.exists(hook): |
| return |
| - return RunCommand([hook, upstream_branch], error_ok=error_ok, |
|
ncarter (slow)
2011/01/29 02:19:05
Sorry if my email wasn't totally clear: the entire
|
| - redirect_stdout=False) |
| + # msysgit requires sys.executable to be present. This assumes all hooks are |
| + # scripted in python. Which should be okay. |
| + cmd = [hook, upstream_branch] |
| + if sys.platform == 'win32': |
| + with open(hook, 'r') as f: |
| + if f.readline().startswith('#!/usr/bin/python'): |
| + cmd.insert(0, sys.executable) |
| + else: |
| + DieWithError('It seems your environment is msysgit, and the hook [%s] ' |
| + 'will not execute correctly. The hook must be scripted ' |
| + 'in Python for this to work.') |
| + return RunCommand(cmd, error_ok=error_ok, redirect_stdout=False) |
| def CMDpresubmit(parser, args): |