File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 11CHECK_PUPPET_LINT =" enabled" # enabled, permissive or disabled (permissive runs but return code is ignored)
22USE_PUPPET_FUTURE_PARSER =" enabled" # enabled or disabled
3+ CHECK_INITIAL_COMMIT =" disabled" # enabled or disabled
34export PUPPET_LINT_OPTIONS =" " # puppet-lint options to use if no rc file is present. Defaults to "--no-80chars-check"
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ export TERM
3232# Decide if we want the puppet future parser (already on puppet 4?)
3333CHECK_PUPPET_LINT=" enabled"
3434USE_PUPPET_FUTURE_PARSER=" enabled"
35+ CHECK_INITIAL_COMMIT=" disabled"
3536if [[ -e ${subhook_root} /config.cfg ]] ; then
3637 source " ${subhook_root} /config.cfg"
3738fi
@@ -49,7 +50,18 @@ while read -r oldrev newrev refname; do
4950 oldrev=$( git show-branch | grep ' \*' | grep -v " $newrev " | head -n1 | sed ' s/.*\[\(.*\)\].*/\1/' | sed ' s/[\^~].*//' )
5051 fi
5152
52- for changedfile in $( git diff --name-only " $oldrev " " $newrev " --diff-filter=ACM) ; do
53+ files_list=' '
54+ if [[ " x$oldrev " == ' x' ]]; then
55+ if [[ $CHECK_INITIAL_COMMIT != " disabled" ]] ; then
56+ files_list=$( git ls-tree --full-tree -r HEAD --name-only)
57+ else
58+ echo " Skipping file checks this is the initial commit..."
59+ fi
60+ else
61+ files_list=$( git diff --name-only " $oldrev " " $newrev " --diff-filter=ACM)
62+ fi
63+
64+ for changedfile in $files_list ; do
5365 tmpmodule=" $tmptree /$changedfile "
5466 [[ -f " $tmpmodule " ]] || continue
5567 # check puppet manifest syntax
You can’t perform that action at this time.
0 commit comments