Tools: Allow diffing against arbitrary revisions

Instead of applying PRs as patches and leaving them as staged changes,
the lint builder now checks out the PR branch, so the lint script
must be able to call git diff with more than just --cached.
(The buildbot will call it with "master...".)
This commit is contained in:
Léo Lam 2017-06-05 02:16:29 +02:00
parent 2f41345de2
commit 9c63544445
1 changed files with 4 additions and 1 deletions

View File

@ -4,8 +4,11 @@
fail=0
# Default to staged files, unless a commit was passed.
COMMIT=${1:---cached}
# Loop through each modified file.
for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do
for f in $(git diff --name-only --diff-filter=ACMRTUXB $COMMIT); do
# Filter them.
if ! echo "${f}" | egrep -q "[.](cpp|h|mm)$"; then
continue