blob: b7db2da932e75e9f48221e8b28895cb1635ebfc8 [file] [log] [blame]
Andrew Geissler9b0105c2018-01-10 10:58:35 -08001#!/bin/bash
2
3# This script reformats source files using the clang-format utility.
4#
5# Files are changed in-place, so make sure you don't have anything open in an
6# editor, and you may want to commit before formatting in case of awryness.
7#
8# This must be run on a clean repository to succeed
9#
10# Input parmameter must be full path to git repo to scan
11
12DIR=$1
13cd ${DIR}
14
15echo "Formatting code under $DIR/"
16find . -regextype sed -regex ".*\.[hc]\(pp\)\?" -not -name "*mako*" -print0 | xargs -0 "clang-format-5.0" -i
17
18git --no-pager diff --exit-code