#!/bin/sh

##
# Pre-commit git hook to check if .pp files complain with the puppet-linf format.
##

FILE_PATTERN='\.pp(\..+)?$'

git diff --cached --name-only HEAD~1 | grep -E $FILE_PATTERN | xargs puppet-lint --log-format %{path} | uniq \
&& echo -e 'ERROR: puppet-lint check not passed\n' \
&& exit 1
