This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 0039a4d463 Fix DOS pre-commit hook check. (#12718)
0039a4d463 is described below
commit 0039a4d463bcea059471794e22a064a7f02c8e60
Author: Brian Neradt <[email protected]>
AuthorDate: Tue Dec 2 16:48:18 2025 -0600
Fix DOS pre-commit hook check. (#12718)
It turns out \r isn't recognized by -E (extended regex), using -P (perl)
does recognize it. This also tightens up the .cmake suffix check by
ensuring a literal '.' before cmake rather than any character.
---
tools/git/pre-commit | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/git/pre-commit b/tools/git/pre-commit
index 6714dad521..285d36afdb 100755
--- a/tools/git/pre-commit
+++ b/tools/git/pre-commit
@@ -85,7 +85,7 @@ deactivate
# Now repeat the above for CMakeLists.txt files.
source ${CMAKE_FORMAT_VENV}/bin/activate
-git diff-index --cached --diff-filter=ACMR --name-only HEAD | grep -E
'CMakeLists.txt|.cmake$' | grep -vE "lib/(Catch2|fastlz|ls-hpack|swoc|yamlcpp)"
| while read file; do
+git diff-index --cached --diff-filter=ACMR --name-only HEAD | grep -E
'CMakeLists.txt|\.cmake$' | grep -vE
"lib/(Catch2|fastlz|ls-hpack|swoc|yamlcpp)" | while read file; do
cmake-format "$file" | diff -u "$file" - >>"$cmake_format_patch_file"
done
deactivate
@@ -137,7 +137,8 @@ else
fi
# Check for DOS carriage returns in staged files.
-DOS_CR=$(git diff-index --cached --diff-filter=ACMR --name-only HEAD | grep
-vE "lib/(yamlcpp|Catch2|systemtap)" | grep -vE "\.test_input$" | xargs git
diff --cached | grep -E '^\+.*\r$' || true)
+CR=$(printf '\r')
+DOS_CR=$(git diff-index --cached --diff-filter=ACMR --name-only HEAD | grep
-vE "lib/(yamlcpp|Catch2|systemtap)" | grep -vE "\.test_input$" | xargs git
diff --cached | grep "^+.*${CR}$" || true)
if [ -n "$DOS_CR" ]; then
echo "The commit is not accepted because it contains DOS carriage returns."
echo "The easiest way to fix this is to run:"
@@ -149,6 +150,4 @@ else
echo
fi
-# Cleanup before exit
-rm -f "$clang_patch_file" "$yapf_patch_file"
exit 0