WIP - Custom hooks POC

This is a rough proof of concept for implementing server-side custom hooks. It is meant to spark discussion. We can add implementation for all types of hooks that git supports. If a user places a properly named hook file in the proper location, gitlab shell will just execute it and pass the proper args based on what the hook type receives on stdin.

Custom hook directory structure would look exactly like the repository directory:
`${namespace}/${repo_name}/pre-receive`, etc

## What's missing in this POC?
1. Obviously, there's not actual code in the custom hooks class.
1. There will probably need to be a new config key for custom hooks directory path.
1. Other hooks types - pre-commit/etc
hi @dblessing. Good job. Where would the custom hooks be located?
Some comments on the pre-receive hook changes:
1) You're calling the custom hook before the gitlab acccess control check. I think this is akin to making a pre-authorization hook and the hook name should reflect that.
2) You should also have a call to the custom hook after the gitlab hook access control check. You can call this one the pre-receive one as it will then be equivalent (in my eyes) to where a standard git hook would be called. For example, if accessing that repo thru ssh.
If you only intend to have one such call to a custom hook, I'd give a preference to have this be for a custom pre-receive hook and that it be called after the gitlab access control check.
3) The gitlab pre-receive hooks sets up an environment variable called 'GL_ID' .  Further on, the exec method in the gitLabCustomHook exec method unsets this variable if the access control check fails. A comment there says  "reset GL_ID env since we stop git push here" (gitlab_access.rb). I didn't look into detail into the code to see why this environment variable has to be setup. However, as it's set up in one place and unset elsewhere, this seems to point out that you should do the same before the call to exit 1. You could do this in the GitlabCustomHook function and document that the custom hook must return true or false rather than exit.
However, a best practice would be to set and unset those variables in the same place. That's what I would do myself and instead of having multiple exit 1, just have a single exit 0 and and an exit 1 and unset the env. variable before the call to the exit 1.