Skip to content

Commit

Permalink
scripts: Fix clangfmt script when no C files were found
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechMazur committed Mar 5, 2024
1 parent 2bb9cc6 commit 8d4d598
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions scripts/clangfmt
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,11 @@ if [ "$#" -gt 0 ]; then
elif [[ "$CHECK_MODIFIED_ONLY" == "1" ]]; then
git diff --name-only main | \
grep -E '.*\.(c|h|cpp|hpp)$' | \
xargs "$clang_format" --style=file "$opts" $err || \
die "C/C++ code formatting changes detected" \
"Run '$0' to reformat."
(xargs "$clang_format" --style=file "$opts" $err || die "C/C++ code formatting changes detected, Run '$0' to reformat.")

else
find . -name "*.[ch]" -or -name "*.[ch]pp" | \
grep -E -v '.*/target/scala.*' | \
grep -E -v ".*/(.venv|.scala-build)/" | \
xargs "$clang_format" --style=file "$opts" $err || \
die "C/C++ code formatting changes detected" \
"Run '$0' to reformat."
(xargs "$clang_format" --style=file "$opts" $err || die "C/C++ code formatting changes detected, Run '$0' to reformat.")
fi

0 comments on commit 8d4d598

Please sign in to comment.