mirror of https://github.com/swig/swig.git
13 lines
573 B
Bash
Executable File
13 lines
573 B
Bash
Executable File
#!/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
|