InfiniTime/hooks/pre-commit
2024-01-12 14:42:53 +01:00

9 lines
332 B
Bash
Executable File

#!/bin/sh
changedFiles="$(git clang-format --extensions cpp,h --style file --staged -q --diffstat -- ':!src/FreeRTOS' ':!src/libs')"
git clang-format --extensions cpp,h --style file --staged -q -- ':!src/FreeRTOS' ':!src/libs'
echo "$changedFiles" | head -n -1 | cut -d ' ' -f 1 | while read -r file; do
git add -- "$file"
done