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