chore: Refactor pre-commit hook to improve performance and readability
This commit is contained in:
@@ -4,15 +4,7 @@ if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then
|
|||||||
exec < /dev/tty
|
exec < /dev/tty
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$(pwd)/vendor/bin/pint $@
|
files=$(git diff --cached --name-only --diff-filter=ACM -- '*.php');
|
||||||
# Get the list of files that were modified by Pint
|
$(pwd)/vendor/bin/pint $files -q
|
||||||
modified_files=$(git diff --name-only --cached)
|
|
||||||
echo $modified_files
|
|
||||||
# Add the modified files back to the staging area
|
|
||||||
if [ -n "$modified_files" ]; then
|
|
||||||
echo "Adding fixed files to the commit..."
|
|
||||||
git add $modified_files
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
git add $files
|
||||||
|
|||||||
Reference in New Issue
Block a user