Correctly handle exclude patterns in git_hook

The git hook wasn't handling exclude patterns correctly. This commit fixes that problem.