You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
589 B
24 lines
589 B
10 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
9 years ago
|
FILE=$1
|
||
9 years ago
|
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||
|
|
||
9 years ago
|
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
|
||
9 years ago
|
|
||
|
echo
|
||
9 years ago
|
git --no-pager diff --no-index --minimal --histogram --color=always $FILE $FILE.pretty
|
||
|
rm -f $FILE.pretty
|
||
9 years ago
|
echo
|
||
|
|
||
9 years ago
|
if [[ $PX4_ASTYLE_FIX -eq 1 ]]; then
|
||
|
${DIR}/fix_code_style.sh $FILE
|
||
9 years ago
|
else
|
||
8 years ago
|
echo $FILE 'bad formatting, please run "make format" or "./Tools/astyle/fix_code_style.sh' $FILE'"'
|
||
9 years ago
|
exit 1
|
||
|
fi
|
||
9 years ago
|
fi
|
||
10 years ago
|
fi
|