From ef8fa17e7c748362cafea73132a1e84fe209733b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Thu, 3 Apr 2025 04:36:10 +0000 Subject: [PATCH] simplify clang-format script (#5274) checked that -print0 & -0 also exist in apple's manpages --- run-clang-format.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/run-clang-format.sh b/run-clang-format.sh index 6f9fc0c80..656c738c6 100755 --- a/run-clang-format.sh +++ b/run-clang-format.sh @@ -18,12 +18,11 @@ # ! -path "soh/assets/*" # asset headers are autogenerated, don't fight them # -# | sed 's| |\\ |g' -# pipe the result of find into sed to -# ensure all the paths returned by find have spaces escaped +# -print0 +# separate paths with NUL bytes, avoiding issues with spaces in paths # -# | xargs clang-format-14 -i +# | xargs -0 clang-format-14 -i # use xargs to take each path we've found # and pass it as an argument to clang-format -find soh -type f \( -name "*.c" -o -name "*.cpp" -o \( -name "*.h" ! -path "soh/src/**.h" ! -path "soh/include/**.h" \) \) ! -path "soh/assets/*" | sed 's| |\\ |g' | xargs clang-format-14 -i +find soh -type f \( -name "*.c" -o -name "*.cpp" -o \( -name "*.h" ! -path "soh/src/**.h" ! -path "soh/include/**.h" \) \) ! -path "soh/assets/*" -print0 | xargs -0 clang-format-14 -i