Switch branches/tags
sigc1_1_before_patch short-class-names-branch-anchor python22-branch-anchor pygtk-2-6-anchor pygtk-2-4-anchor pygtk-2-0-anchor PYGTK_2_8_2 PYGTK_2_8_1 PYGTK_2_8_0 PYGTK_2_7_4 PYGTK_2_7_3 PYGTK_2_7_2 PYGTK_2_7_1 PYGTK_2_7_0 PYGTK_2_6_3 PYGTK_2_6_2 PYGTK_2_6_1 PYGTK_2_6_0 PYGTK_2_5_4 PYGTK_2_5_3 PYGTK_2_5_2 PYGTK_2_5_1 PYGTK_2_5_0 PYGTK_2_4_1 PYGTK_2_4_0 PYGTK_2_3_97 PYGTK_2_3_96 PYGTK_2_3_95 PYGTK_2_3_94 PYGTK_2_3_93 PYGTK_2_3_92 PYGTK_2_3_91 PYGTK_2_3_90 PYGTK_2_2_0 PYGTK_2_0_0 PYGTK_1_99_18 PYGTK_1_99_17 PYGTK_1_99_16 PYGTK_1_99_14 PYGTK_1_99_13 PYGTK_1_99_12 PYGTK_1_99_11 PYGTK_1_99_10 PYGTK_1_99_9 PYGTK_1_99_8 PYGTK_1_99_7 PYGTK_1_99_6 PYGTK_1_99_5 PYGTK_1_99_4 PYGTK_1_99_3 PYGTK_1_99_2 PYGTK_1_99_1 PYGTK_1_99 PYGTK_0_6_11 PYGTK_0_6_10 PYGTK_0_6_7 PYGOBJECT_2_28_6 PYGOBJECT_2_28_4 PYGOBJECT_2_28_3 PYGOBJECT_2_28_3_tag_correction PYGOBJECT_2_28_3_WINDOWS PYGOBJECT_2_28_2 PYGOBJECT_2_28_1 PYGOBJECT_2_28_0 PYGOBJECT_2_27_91 PYGOBJECT_2_27_90 PYGOBJECT_2_26_0_1_WINDOWS PYGOBJECT_2_26_0 PYGOBJECT_2_21_5 PYGOBJECT_2_21_4 PYGOBJECT_2_21_3 PYGOBJECT_2_21_2 PYGOBJECT_2_21_1 PYGOBJECT_2_21_0 PYGOBJECT_2_20_0 PYGOBJECT_2_19_0 PYGOBJECT_2_19_0_WINDOWS PYGOBJECT_2_18_0 PYGOBJECT_2_17_0 PYGOBJECT_2_16_0 PYGOBJECT_2_15_4 PYGOBJECT_2_15_3 PYGOBJECT_2_15_2 PYGOBJECT_2_15_1 PYGOBJECT_2_15_0 PYGOBJECT_2_14_2 PYGOBJECT_2_14_1 PYGOBJECT_2_14_0 PYGOBJECT_2_13_2 PYGOBJECT_2_13_1 PYGOBJECT_2_13_0 PYGOBJECT_2_12_3 PYGOBJECT_2_12_2 PYGOBJECT_2_12_1 PYGOBJECT_2_12_0 PYGOBJECT_2_11_4 PYGOBJECT_2_11_3 PYGOBJECT_2_11_2 PYGOBJECT_2_11_1 PYGOBJECT_2_11_0
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 40 lines (36 sloc) 1.79 KB
# Check that the code follows a consistant code style
# Check for existence of astyle, and error out if not present.
if ! builtin type -P astyle; then
echo "PyGI git pre-commit hook:"
echo "Did not find astyle, please install it before continuing."
exit 1
ASTYLE_PARAMETERS="-p -d -c -S -U -M60"
echo "--Checking style--"
for file in `git-diff-index --cached --name-only HEAD --diff-filter=ACMR| grep "\.c$"` ; do
# nf is the temporary checkout. This makes sure we check against the
# revision in the index (and not the checked out version).
nf=`git checkout-index --temp ${file} | cut -f 1`
newfile=`mktemp /tmp/${nf}.XXXXXX` || exit 1
astyle ${ASTYLE_PARAMETERS} < $nf > $newfile 2>> /dev/null
diff -u -p "${nf}" "${newfile}"
rm "${newfile}"
rm "${nf}"
if [ $r != 0 ] ; then
echo "================================================================================================="
echo " Code style error in: $file "
echo " "
echo " Please fix before committing. Don't forget to run git add before trying to commit again. "
echo " If the whole file is to be committed, this should work (run from the top-level directory): "
echo " "
echo " astyle ${ASTYLE_PARAMETERS} $file; git add $file; git commit"
echo " "
echo "================================================================================================="
exit 1
echo "--Checking style pass--"