Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index cb93095c8d89555cc04ae6409113d64c7de04b2a..ca07730e3e3ec862c833adf08f20c355488fe4f4 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -2267,6 +2267,15 @@ def CMDformat(parser, args): |
| if not os.path.exists(cfd_path): |
| DieWithError('Could not find clang-format-diff at %s.' % cfd_path) |
| cmd = [sys.executable, cfd_path, '-p0', '-style', 'Chromium'] |
| + |
| + # Newer versions of clang-format-diff.py require an explicit -i flag |
| + # to apply the edits to files, otherwise it just displays a diff. |
| + # Probe the usage string to verify if this is needed. |
| + help_text = RunCommand([sys.executable, cfd_path, '-h']) |
| + help_line1 = help_text.split('\n')[0] |
|
M-A Ruel
2013/10/25 15:19:09
if '[-i]' in help_text:
cmd.append('-i')
assume
digit1
2013/10/25 15:25:21
Excellent suggestion thanks. I used the first vers
|
| + if help_line1.find('[-i]') >= 0: |
| + cmd.append('-i') |
| + |
| RunCommand(cmd, stdin=diff_output, cwd=top_dir) |
| return 0 |