diff options
author | Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> | 2015-10-05 15:54:27 +0300 |
---|---|---|
committer | Lukas Slebodnik <lslebodn@redhat.com> | 2015-10-07 06:52:18 +0200 |
commit | d8899526551cbfe112e0ecc8280003a8349fc531 (patch) | |
tree | e6d2ca18c9905eea0aeea177fa1563ee96f74722 /src | |
parent | a741d0c4345dceb27dfbb20b81fd858a514b47cd (diff) | |
download | sssd-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>
Diffstat (limited to 'src')
-rwxr-xr-x | src/tests/whitespace_test | 7 |
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 |