Skip to content

Commit 2381706

Browse files
committed
chore: Refactor pre-commit hook to improve performance and readability
1 parent 7a0f054 commit 2381706

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

hooks/pre-commit

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@ if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then
44
exec < /dev/tty
55
fi
66

7-
$(pwd)/vendor/bin/pint $@
8-
# Get the list of files that were modified by Pint
9-
modified_files=$(git diff --name-only --cached)
10-
echo $modified_files
11-
# Add the modified files back to the staging area
12-
if [ -n "$modified_files" ]; then
13-
echo "Adding fixed files to the commit..."
14-
git add $modified_files
15-
fi
16-
17-
7+
files=$(git diff --cached --name-only --diff-filter=ACM -- '*.php');
8+
$(pwd)/vendor/bin/pint $files -q
189

10+
git add $files

0 commit comments

Comments
 (0)