2004-03-14 17:54:22 +00:00
|
|
|
#!/bin/sh
|
2009-11-04 01:54:36 +00:00
|
|
|
|
2015-06-03 16:04:15 +00:00
|
|
|
for execname in gnuindent gindent indent; do
|
|
|
|
version=`$execname --version 2>/dev/null`
|
|
|
|
if test "x$version" != "x"; then
|
|
|
|
INDENT=$execname
|
|
|
|
break
|
2009-11-04 01:54:36 +00:00
|
|
|
fi
|
2015-06-03 16:04:15 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
if test -z $INDENT; then
|
|
|
|
echo "GStreamer git pre-commit hook:"
|
|
|
|
echo "Did not find GNU indent, please install it before continuing."
|
|
|
|
exit 1
|
2009-11-04 01:54:36 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
case `$INDENT --version` in
|
|
|
|
GNU*)
|
|
|
|
;;
|
|
|
|
default)
|
|
|
|
echo "Did not find GNU indent, please install it before continuing."
|
|
|
|
echo "(Found $INDENT, but it doesn't seem to be GNU indent)"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2014-10-18 06:27:04 +00:00
|
|
|
# Run twice. GNU indent isn't idempotent
|
|
|
|
# when run once
|
|
|
|
for i in 1 2; do
|
2009-11-04 01:54:36 +00:00
|
|
|
$INDENT \
|
2004-03-13 15:17:30 +00:00
|
|
|
--braces-on-if-line \
|
|
|
|
--case-brace-indentation0 \
|
|
|
|
--case-indentation2 \
|
|
|
|
--braces-after-struct-decl-line \
|
|
|
|
--line-length80 \
|
2004-03-15 19:27:17 +00:00
|
|
|
--no-tabs \
|
2004-03-13 15:17:30 +00:00
|
|
|
--cuddle-else \
|
|
|
|
--dont-line-up-parentheses \
|
|
|
|
--continuation-indentation4 \
|
|
|
|
--honour-newlines \
|
|
|
|
--tab-size8 \
|
|
|
|
--indent-level2 \
|
2010-03-29 06:43:05 +00:00
|
|
|
--leave-preprocessor-space \
|
2014-10-18 06:27:04 +00:00
|
|
|
$* || exit $?
|
|
|
|
done
|