blob: a6b3d08a265b0144c711ffc0ddd5a1781b15c2f1 [file] [log] [blame]
Yegor Timoshenkoc2e49412018-10-07 01:58:27 +00001#!/usr/bin/env bash
Ronald G. Minnichff22b6ac2018-08-01 07:19:31 -07002files=`git diff --cached --name-only | grep '\.[ch]$'`
3if [ -z "$files" ]; then
4 exit 0
5fi
6# This has to be set here; otherwise a grep error seems to cause
7# us to exit with non-zero status.
8set -e
9clang-format -i $files
10git add $files
11u=`git config user.name`
12m="clang-formatted-by: $u"
13echo $m >> $1