speed up _get_file_diff slightly
This func just wants to scan & extract the diff, so including the commit
message is pointless. Tweak the git show command so that it doesn't even
bother omitting that.
BUG=chromium:340036
TEST=`./pre-upload_unittest.py` passes
TEST=ran against some CLs w/bad diffs and made sure they were still caught
Change-Id: I018ad730f2cad627fd18baa257b8437ba1d43e8c
Reviewed-on: https://chromium-review.googlesource.com/184610
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 9ec5d1d..6bc0e15 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -216,7 +216,8 @@
def _get_file_diff(file, commit):
"""Returns a list of (linenum, lines) tuples that the commit touched."""
- output = _run_command(['git', 'show', '-p', '--no-ext-diff', commit, file])
+ output = _run_command(['git', 'show', '-p', '--pretty=format:',
+ '--no-ext-diff', commit, file])
new_lines = []
line_num = 0