From 9c63544445bb64b38f4a510be0e3928ba0db138e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Mon, 5 Jun 2017 02:16:29 +0200 Subject: [PATCH] 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...".) --- Tools/lint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tools/lint.sh b/Tools/lint.sh index 345cc3fbaa..aeab86d7d0 100755 --- a/Tools/lint.sh +++ b/Tools/lint.sh @@ -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