diff options
Diffstat (limited to 'util/scripts')
-rwxr-xr-x | util/scripts/prepare-commit-msg.clang-format | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/util/scripts/prepare-commit-msg.clang-format b/util/scripts/prepare-commit-msg.clang-format new file mode 100755 index 0000000000..7033f3cc07 --- /dev/null +++ b/util/scripts/prepare-commit-msg.clang-format @@ -0,0 +1,13 @@ +#!/bin/bash +files=`git diff --cached --name-only | grep '\.[ch]$'` +if [ -z "$files" ]; then + exit 0 +fi +# This has to be set here; otherwise a grep error seems to cause +# us to exit with non-zero status. +set -e +clang-format -i $files +git add $files +u=`git config user.name` +m="clang-formatted-by: $u" +echo $m >> $1 |