Skip to content

Commit

Permalink
fix(meta): fix formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
luishfonseca committed Sep 28, 2023
1 parent 20ff1ac commit 5d857d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 8 additions & 2 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/sh
for file in $(git diff --cached --name-only | grep -E '.*\.(c|cpp|h|hpp)$')
for file in $(git diff --cached --name-only --diff-filter=ACMR | grep -E '.*\.(c|cpp|h|hpp)$')
do
PARTIAL_STAGED=$(git diff --name-only $file | wc -l)

clang-format -i $file
git add $file

# Add unless the file was partially staged
if [ $PARTIAL_STAGED -eq 0 ]; then
git add $file
fi
done
5 changes: 1 addition & 4 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ jobs:
- name: Check
run: |
for file in $(git diff -U0 --name-only HEAD^ | grep -E '.*\.(c|cpp|h|hpp)$'); do
if [ ! -f $file ]; then
continue
fi
for file in $(git diff -U0 --name-only --diff-filter=ACMR HEAD^ | grep -E '.*\.(c|cpp|h|hpp)$'); do
clang-format --dry-run -Werror $file || exit 1
done

0 comments on commit 5d857d0

Please sign in to comment.