icefox/git-hooks — pull request #22 by sercxanto (2013-08-24 18:19:38+00:00)
Title: Fix too much hooks reported in list_hooks_in_dir

This change is related to
[pull request #16](https://github.com/icefox/git-hooks/pull/16) but
fixes the problem in a more general way.

list_hooks_in_dir should report exactly the hooks that would be run with
run_hooks. But the find command in list_hooks_in_dir does not limit itself to
the scheme "folder_name/hook_name" but recurses infinitely through sub
directories reporting all executable files. If your hooks are stored itself in
a git repository then consequently also the files in .git/hooks are reported.

This change sets the search depth exactly to two, so that the correct scripts
are reported, e.g. :
~/.git_hooks/commit-msg/script1

but not e.g. :

~/.git_hook/.git/hooks/commit-msg
~/.git_hooks/script2
~/.git_hooks/commit-msg/dir2/script3