blob: a6b3d08a265b0144c711ffc0ddd5a1781b15c2f1 [file] [log] [blame]
#!/usr/bin/env 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