pre-upload: Separate paths from revisions with '--'
Current 'git diff' command fails with the following error:
fatal: ambiguous argument
'/chromiumos/src/platform/bmpblk/images/build_images.py':
unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Hence, separate paths from revisions with '--'.
BUG=none
TEST=repo upload . --cbr
Change-Id: I06216ad2e677aa3e0912a39a7d3f3f6eec77e9f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/repohooks/+/2423604
Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
Tested-by: Yu-Ping Wu <yupingso@chromium.org>
Auto-Submit: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 56413c0..56209f1 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -275,7 +275,7 @@
return cache[path]
if commit == PRE_SUBMIT:
- content = _run_command(['git', 'diff', 'HEAD', path])
+ content = _run_command(['git', 'diff', 'HEAD', '--', path])
else:
content = _run_command(['git', 'show', '%s:%s' % (commit, path)])
cache[path] = content
@@ -291,10 +291,10 @@
if commit == PRE_SUBMIT:
command = ['git', 'diff', '-p', '--pretty=format:', '--no-ext-diff', 'HEAD',
- path]
+ '--', path]
else:
command = ['git', 'show', '-p', '--pretty=format:', '--no-ext-diff', commit,
- path]
+ '--', path]
output = _run_command(command)
new_lines = []