summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2015-10-05 15:54:27 +0300
committerLukas Slebodnik <lslebodn@redhat.com>2015-10-07 06:52:18 +0200
commitd8899526551cbfe112e0ecc8280003a8349fc531 (patch)
treee6d2ca18c9905eea0aeea177fa1563ee96f74722
parenta741d0c4345dceb27dfbb20b81fd858a514b47cd (diff)
downloadsssd-d8899526551cbfe112e0ecc8280003a8349fc531.tar.gz
sssd-d8899526551cbfe112e0ecc8280003a8349fc531.tar.xz
sssd-d8899526551cbfe112e0ecc8280003a8349fc531.zip
TESTS: Make whitespace_test pass without whitespace
Make whitespace_test pass if no trailing whitespace was detected at all. Add two comments explaining how searching and failure handling works. Fixes: https://fedorahosted.org/sssd/ticket/2816 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
-rwxr-xr-xsrc/tests/whitespace_test7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tests/whitespace_test b/src/tests/whitespace_test
index ea2aecf60..e972b3083 100755
--- a/src/tests/whitespace_test
+++ b/src/tests/whitespace_test
@@ -14,7 +14,12 @@ if [ ! -d "$GIT_DIR" ]; then
exit 77
fi
-git grep -n -I '\s\+$' -- "$(git rev-parse --show-toplevel)" |
+{
+ # Look for lines with trailing whitespace in all files tracked by Git
+ git grep -n -I '\s\+$' -- "$(git rev-parse --show-toplevel)" ||
+ # Don't fail if no such lines were found anywhere
+ [[ $? == 1 ]]
+} |
awk -- "
BEGIN {
found = 0