From a88679a26f51351d8b250ca71572b24028caa54c Mon Sep 17 00:00:00 2001 From: Ramon Roche Date: Mon, 17 Mar 2025 20:20:42 -0700 Subject: [PATCH] tools: exclude docs from newline checks (#24531) Signed-off-by: Ramon Roche --- Tools/astyle/check_newlines.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/astyle/check_newlines.sh b/Tools/astyle/check_newlines.sh index 5160476935..27bae97112 100755 --- a/Tools/astyle/check_newlines.sh +++ b/Tools/astyle/check_newlines.sh @@ -3,14 +3,14 @@ return_value=0 # Check if there are files checked in that don't end in a newline (POSIX requirement) -git grep --cached -Il '' | xargs -L1 bash -c 'if test "$(tail -c 1 "$0")"; then echo "No new line at end of $0"; exit 1; fi' +git grep --cached -Il '' -- ':!docs/*' | xargs -L1 bash -c 'if test "$(tail -c 1 "$0")"; then echo "No new line at end of $0"; exit 1; fi' if [ $? -ne 0 ]; then return_value=1 fi # Check if there are files checked in that have duplicate newlines at the end (fail trailing whitespace checks) -git grep --cached -Il '' | xargs -L1 bash -c 'if tail -c 2 "$0" | ( read x && read y && [ x"$x" = x ] && [ x"$y" = x ]); then echo "Multiple newlines at the end of $0"; exit 1; fi' +git grep --cached -Il '' -- ':!docs/*' | xargs -L1 bash -c 'if tail -c 2 "$0" | ( read x && read y && [ x"$x" = x ] && [ x"$y" = x ]); then echo "Multiple newlines at the end of $0"; exit 1; fi' if [ $? -ne 0 ]; then return_value=1