cbff3fcdce5b0377a62fbe74f32e476efbf7ca9cNikolai Kondrashov# An AWK regex matching tracked file paths to be excluded from the search.
cbff3fcdce5b0377a62fbe74f32e476efbf7ca9cNikolai Kondrashov# Example: '.*\.po|README'
cbff3fcdce5b0377a62fbe74f32e476efbf7ca9cNikolai KondrashovPATH_EXCLUDE_REGEX='.*\.po|.*\.patch|.*\.diff|\/debian\/.*'
cbff3fcdce5b0377a62fbe74f32e476efbf7ca9cNikolai Kondrashovif [ ! -d "$GIT_DIR" ]; then
cbff3fcdce5b0377a62fbe74f32e476efbf7ca9cNikolai Kondrashov echo "Git repository is required for this test!" 1>&2
d8899526551cbfe112e0ecc8280003a8349fc531Nikolai Kondrashov # Look for lines with trailing whitespace in all files tracked by Git
d8899526551cbfe112e0ecc8280003a8349fc531Nikolai Kondrashov git grep -n -I '\s\+$' -- "$(git rev-parse --show-toplevel)" ||
d8899526551cbfe112e0ecc8280003a8349fc531Nikolai Kondrashov # Don't fail if no such lines were found anywhere
cbff3fcdce5b0377a62fbe74f32e476efbf7ca9cNikolai Kondrashov print \"Trailing whitespace found:\"
900778b5afd0143005cfd40cc67ad5086481f7eeLukas Slebodnikwhile read file; do
900778b5afd0143005cfd40cc67ad5086481f7eeLukas Slebodnik [[ $file == "src/config/testconfigs/noparse.api.conf" ]] && continue
0bdd8800c16f39b8fe308d20694ad905c669dff3Sumit Bose [[ $file =~ ^src/tests/cmocka/p11_nssdb.*/.*db ]] && continue
900778b5afd0143005cfd40cc67ad5086481f7eeLukas Slebodnik test `tail -c 1 $ABS_TOP_SRCDIR/$file` && \
900778b5afd0143005cfd40cc67ad5086481f7eeLukas Slebodnik echo "Missing new line at the eof: $file" && \