From d8899526551cbfe112e0ecc8280003a8349fc531 Mon Sep 17 00:00:00 2001 From: Nikolai Kondrashov Date: Mon, 5 Oct 2015 15:54:27 +0300 Subject: TESTS: Make whitespace_test pass without whitespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/tests/whitespace_test | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tests/whitespace_test b/src/tests/whitespace_test index ea2aecf6..e972b308 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 -- cgit