pre/post commit hooks both run before and after commit
The pre commit hooks are not only run before the commit and the post commit hooks are not only run after the commit. I think run_commit_hook
is missing a check if the file ending actually matches the current type.
Also files which don't end in .{pre,post}-commit
shouldn't be executed at all.