Fix project hook and branch identification.

- Branch now removes /refs/heads
- Ensure that the project hook takes precedence over the action hook.
- Add more spaces to make the code less ugly.