pre-upload: Unbreak per-line checks.
Some of the per-line checks (line too long, stray whitespace, tab
characters in file) have been broken since
https://chromium-review.googlesource.com/#/c/205172/
This CL fixes them.
BUG=chromium:676699
TEST=Manual. Create a bogus CL with these issues and run pre-upload.py
Change-Id: I51b6ee869a9264b3866d6b4b6fd21b79320fe9a6
Reviewed-on: https://chromium-review.googlesource.com/423002
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 2c14bb5..7677605 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -243,11 +243,12 @@
def _get_file_diff(path, commit):
"""Returns a list of (linenum, lines) tuples that the commit touched."""
- command = ['git', 'diff', '-p', '--pretty=format:', '--no-ext-diff']
if commit == PRE_SUBMIT:
- command += ['HEAD', path]
+ command = ['git', 'diff', '-p', '--pretty=format:', '--no-ext-diff', 'HEAD',
+ path]
else:
- command += [commit, path]
+ command = ['git', 'show', '-p', '--pretty=format:', '--no-ext-diff', commit,
+ path]
output = _run_command(command)
new_lines = []