summaryrefslogtreecommitdiff
path: root/util/scripts/prepare-commit-msg.clang-format
blob: 7033f3cc07b58236c512bf9817c5707d0f70ff34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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