Skip to content

Commit

Permalink
chore: precommit hook must not check deleted or renamed files (#1071)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind authored Nov 4, 2024
1 parent 3244b9e commit 341a64f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/git-precommit-hook.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

CFILES=$(git diff-index --cached --name-only HEAD | grep -E "^(examples|include|src|tests/unit).*\.(c|h|cpp)$")
PYFILES=$(git diff-index --cached --name-only HEAD | grep -E "^tests.*\.py$")
CFILES=$(git diff-index --cached --name-only --diff-filter=dr HEAD | grep -E "^(examples|include|src|tests/unit).*\.(c|h|cpp)$")
PYFILES=$(git diff-index --cached --name-only --diff-filter=dr HEAD | grep -E "^tests.*\.py$")

if [ -n "$CFILES" ]; then
.venv/bin/clang-format -i $CFILES
Expand Down

0 comments on commit 341a64f

Please sign in to comment.