2015-01-05 23:16:30 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2016-04-21 17:29:49 -04:00
|
|
|
file=$1
|
|
|
|
|
|
|
|
|
|
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
|
|
|
|
|
|
|
|
if [ -f "$file" ];
|
|
|
|
|
then
|
2016-04-24 19:25:31 -04:00
|
|
|
${DIR}/fix_code_style.sh --dry-run $file | grep --quiet Formatted
|
|
|
|
|
if [[ $? -eq 0 ]]
|
|
|
|
|
then
|
2016-06-21 11:49:42 -04:00
|
|
|
${DIR}/fix_code_style.sh --quiet < $file > $file.pretty
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
git diff --no-index --minimal --histogram --color=always $file $file.pretty
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
|
|
rm -f $file.pretty
|
2016-04-24 19:25:31 -04:00
|
|
|
echo $file 'bad formatting, please run "./Tools/fix_code_style.sh' $file'"'
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2015-01-05 23:16:30 -05:00
|
|
|
fi
|
2016-04-21 17:29:49 -04:00
|
|
|
|