#!/bin/bash
+if ! cmp -s ${PWD}/.git/hooks/pre-commit ${PWD}/tools/git-hooks/pre-commit ; then
+ rm -f ${PWD}/.git/hooks/pre-commit
+ ln -sf ../../tools/git-hooks/pre-commit ${PWD}/.git/hooks/pre-commit
+ exec ${PWD}/.git/hooks/pre-commit
+fi
+
if git rev-parse --verify HEAD &>/dev/null; then
against=HEAD
else
git cat-file blob :0:${file} | sed 's/^import .*/#&/' >${pp}
trap "rm -f ${pp}" RETURN
- local output=$(puppet apply --noop --ignoreimport ${pp} 2>&1)
+ local output=$(puppet parser validate ${pp} 2>&1)
if [ $? -ne 0 ] || [ -n "${output}" ]; then
echo '** Syntax check failed:' >&2
echo "${output}" >&2
case "${file}" in
manifests/site.pp|modules/*/manifests/*)
if [[ -n "$(which puppet-lint)" ]]; then
- puppet-lint --no-hard_tabs-check --no-80chars-check ${pp} >&2 | uniq
+ puppet-lint --no-hard_tabs-check --no-2sp_soft_tabs-check --no-80chars-check ${pp} >&2 | uniq
else
echo "Please install puppet-lint (gem install puppet-lint)" >&2
fi