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 1
1
CHECK_PUPPET_LINT =" enabled" # enabled, permissive or disabled (permissive runs but return code is ignored)
2
2
USE_PUPPET_FUTURE_PARSER =" enabled" # enabled or disabled
3
+ CHECK_INITIAL_COMMIT =" disabled" # enabled or disabled
3
4
export 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
32
32
# Decide if we want the puppet future parser (already on puppet 4?)
33
33
CHECK_PUPPET_LINT=" enabled"
34
34
USE_PUPPET_FUTURE_PARSER=" enabled"
35
+ CHECK_INITIAL_COMMIT=" disabled"
35
36
if [[ -e ${subhook_root} /config.cfg ]] ; then
36
37
source " ${subhook_root} /config.cfg"
37
38
fi
@@ -49,7 +50,18 @@ while read -r oldrev newrev refname; do
49
50
oldrev=$( git show-branch | grep ' \*' | grep -v " $newrev " | head -n1 | sed ' s/.*\[\(.*\)\].*/\1/' | sed ' s/[\^~].*//' )
50
51
fi
51
52
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
53
65
tmpmodule=" $tmptree /$changedfile "
54
66
[[ -f " $tmpmodule " ]] || continue
55
67
# check puppet manifest syntax
You can’t perform that action at this time.
0 commit comments