Paul Menzel (paulepanter@users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3340
-gerrit
commit af86a02c047995b3e2867f355649bbf39621286b Author: Paul Menzel paulepanter@users.sourceforge.net Date: Thu May 30 14:24:26 2013 +0200
lint: Extend whitespace check to test all lines of a commit
To not break the build, the current lint whitespace check excludes several directories/files with whitespace issues. As a result some- times whitespace issues are missed [1].
Replace this check with the command from the sample pre-commit hook shipped by git. The check only looks at the diff and therefore we catch corner cases.
The check using git is faster as it only checks the diff and not the whole tree with `find`.
I am not sure, what to do about the copyright line.
[1] http://review.coreboot.org/#/c/3319/1/src/cpu/ti/am335x/uart.h
Change-Id: I856fa43d77729cf72bf2603119b93f9b99026a97 Signed-off-by: Paul Menzel paulepanter@users.sourceforge.net --- util/lint/lint-stable-003-whitespace | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/util/lint/lint-stable-003-whitespace b/util/lint/lint-stable-003-whitespace index 6869a44..205d101 100755 --- a/util/lint/lint-stable-003-whitespace +++ b/util/lint/lint-stable-003-whitespace @@ -18,25 +18,13 @@ # # DESCR: Check for superfluous whitespace in the tree
-LC_ALL=C export LC_ALL -find src util -name .svn -type d -prune -o \ - -perm +111 -prune -o \ - -name .git -type d -prune -o \ - -name README -prune -o \ - -name LICENSE -prune -o \ - -name TODO -prune -o \ - -name COPYING -prune -o \ - -name *.txt -prune -o \ - -name *.exe -prune -o \ - -name *.o -prune -o \ - -name microcode-*.h -prune -o \ - -name *.?_shipped -prune -o \ - -name *.[18] -prune -o \ - -name kconfig -type d -prune -o \ - -name romcc -type d -prune -o \ - -name crossgcc -type d -prune -o \ - -name vendorcode -type d -prune -o \ - -type f -exec \ - grep -l "[[:space:]][[:space:]]*$" {} + | \ - sed -e "s,^.*$,File & has lines ending with whitespace.," +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi
+# If there are whitespace errors, print the offending file names and fail. +git diff-index --check --cached $against --