Git operations are costly. Before, if file locks and all file locks were enabled we would iterate over each commit twice and over each diff as much as 4 times. This updates uses lambdas to go through all neccessary validations in only one iteration per commit and per diff. It also removes some unused code in lib/gitlab/git_access.rb and adds examples to ensure the code keeps working as intended.
Valery: Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/880