URL:
https://github.com/SSSD/sssd/pull/83
Title: #83: TESTS: Check new line at end of file
lslebodn commented:
"""
On (21/11/16 04:11), Nikolai Kondrashov wrote:
spbnick commented on this pull request.
> @@ -35,3 +35,15 @@ fi
exit found
}
"
+
+declare found_file=0
+git ls-files | \
+ grep -v "^src/config/testconfigs/noparse.api.conf" | \
+ grep -v "^src/tests/cmocka/p11_nssdb/.*db" | \
+ while read file; do
+ test `tail -c 1 $file` && \
+ echo "no newline at eof: $file" && \
+ found_file=1
+ done
+
+[ $found_file -eq 1] && exit 1
Another trick is to assign `true` or `false` to `found_file`. Then you can simply write
this:
$found_file && exit 1
will do
"--exclude*" options does not work with
"--cached" which is a defualt.
Unfortuntately, it works only with --others --ignored.
I didn't like that there is "grep -v" twice
but single regex would not be very readable and I a not aware of
better way how to filter out some lines.
Anyway thank you very much for suggestions.
LS
"""
See the full comment at
https://github.com/SSSD/sssd/pull/83#issuecomment-261931169