Skip to content

Commit 5aff3fc

Browse files
authored
Merge pull request drwahl#94 from garethhumphriesworldpay/patch-4
Support native puppet under cygwin
2 parents f6c2d84 + ea904c5 commit 5aff3fc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pre-commit

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,17 @@ else
6262
files_to_check=$(git diff --cached --name-only --diff-filter=ACM)
6363
fi
6464

65+
# On cygwin/windows, puppet is a symlink to native puppet install, which needs windows paths.
66+
if [ "$OSTYPE" == "cygwin" ] && file -L $(which puppet) 2>/dev/null | grep -q 'DOS batch file' && type cygpath >/dev/null 2>&1; then
67+
USE_NATIVE="YES"
68+
fi
6569
for changedfile in $files_to_check; do
6670
[[ -f "$changedfile" ]] || continue
71+
if [ "$USE_NATIVE" == "YES" ]; then
72+
changedfile_native="`cygpath -w "$changedfile"`"
73+
else
74+
changedfile_native="$changedfile"
75+
fi
6776
#check puppet manifest syntax
6877
if type puppet >/dev/null 2>&1; then
6978
if [[ $(echo "$changedfile" | grep -q '\.*\.epp$'; echo $?) -eq 0 ]]; then
@@ -73,7 +82,7 @@ for changedfile in $files_to_check; do
7382
failures=$((failures + 1))
7483
fi
7584
elif [[ $(echo "$changedfile" | grep -q '\.*\.pp$'; echo $?) -eq 0 ]]; then
76-
${subhook_root}/puppet_manifest_syntax_check.sh "$changedfile" "" "$USE_PUPPET_FUTURE_PARSER"
85+
${subhook_root}/puppet_manifest_syntax_check.sh "$changedfile_native" "" "$USE_PUPPET_FUTURE_PARSER"
7786
RC=$?
7887
if [[ "$RC" -ne 0 ]]; then
7988
failures=$((failures + 1))

0 commit comments

Comments
 (0)