Skip to content

Commit 341a64f

Browse files
authored
chore: precommit hook must not check deleted or renamed files (#1071)
1 parent 3244b9e commit 341a64f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/git-precommit-hook.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

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

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

0 commit comments

Comments
 (0)