/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Tools/pre-commit
12 строк
573 B
William S Fulton
Add git pre-commit hook script for checking source formatting with clang-format
05 мар 2026, 01:04
05 мар 2026, 01:04
b2c3e3a
Код
Авторство
О чём код?
#!/bin/sh # Pre-commit git hook for SWIG repository, copy to .git/hooks/pre-commit clang_format=clang-format files_to_format=$(git diff-index --diff-filter=d --name-only HEAD ':Source/*/*.c' ':Source/*/*.cxx' ':Source/*/*.h') if [ -n "$files_to_format" ]; then printf "Running ${clang_format} in git pre-commit hook to validate modified files...\n" if ! ${clang_format} --dry-run --Werror ${files_to_format}; then printf "Error: Fix formatting before committing, see Doc/Manual/Extending.html#Extending_coding_style_guidelines.\n" exit 1 fi fi