Debian Codegraph @

util/scripts/prepare-commit-msg.clang-format

raw
1 #!/usr/bin/env bash
2 files=`git diff --cached --name-only | grep '\.[ch]$'`
3 if [ -z "$files" ]; then
4 exit 0
5 fi
6 # This has to be set here; otherwise a grep error seems to cause
7 # us to exit with non-zero status.
8 set -e
9 clang-format -i $files
10 git add $files
11 u=`git config user.name`
12 m="clang-formatted-by: $u"
13 echo $m >> $1