Starship/tools/check_format.sh

24 lines
514 B
Bash
Raw Normal View History

2023-10-16 20:57:33 +03:00
#!/bin/bash
STATUSOLD=`git status --porcelain`
./tools/format.py -j
if [ $? -ne 0 ]
then
echo "Formatter failed. Exiting."
exit -1
fi
STATUSNEW=`git status --porcelain`
if [ "${STATUSOLD}" != "${STATUSNEW}" ];
then
echo ""
echo "Misformatted files found. Run ./tools/format.py and verify codegen is not impacted."
echo ""
diff --unified=0 --label "Old git status" <(echo "${STATUSOLD}") --label "New git status" <(echo "${STATUSNEW}")
echo ""
echo "Exiting."
exit 1
fi
exit 0