Skip to content

Commit

Permalink
Merge pull request drwahl#7 from cloudevelops/add-submodule-support
Browse files Browse the repository at this point in the history
Add support for submodule check
  • Loading branch information
drwahl committed May 22, 2014
2 parents bd092ff + 058dc0c commit 1c057d7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ if [ ! -z "$hook_symlink" ]; then
subhook_root="$(dirname $hook_symlink)/commit_hooks"
fi

# If using submodules, we need to read proper subhook root
if [ -f "$git_root/.git" ]; then
IFS=": "
while read -r name value
do
if [ $name == "gitdir" ]; then
submodule_hookdir=$value
fi
done < "$git_root/.git"
if [ ! -z "$submodule_hookdir" ]; then
subhook_root="$git_root/$submodule_hookdir/hooks/commit_hooks"
fi
fi

for changedfile in `git diff --cached --name-only --diff-filter=ACM`; do
#check puppet manifest syntax
if type puppet >/dev/null 2>&1; then
Expand Down

0 comments on commit 1c057d7

Please sign in to comment.