chore: update flakebox files

This commit is contained in:
thesimplekid
2023-12-19 21:50:42 +00:00
parent f192a53c03
commit 003ecb9dba
5 changed files with 20 additions and 13 deletions

View File

@@ -132,8 +132,13 @@ export -f check_trailing_newline
function check_trailing_whitespace() {
set -euo pipefail
if ! git diff --check HEAD ; then
echo "Trailing whitespace detected. Please remove them before committing."
rev="HEAD"
if ! git rev-parse -q 1>/dev/null HEAD 2>/dev/null ; then
>&2 echo "Warning: no commits yet, checking against --root"
rev="--root"
fi
if ! git diff --check $rev ; then
>&2 echo "Trailing whitespace detected. Please remove them before committing."
return 1
fi