Extract concerns from HookContext::PreCommit into helper class

The `PreCommit` hook context was getting large due to it juggling a
large number of concerns related to working with `git`.

Extract these concerns into a helper `GitRepo` to make the code a little
more straightforward.

Change-Id: I7670c6e6196fcd81bfad215b92255818dd2574f8
Reviewed-on: http://gerrit.causes.com/40383
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Shane da Silva <shane.dasilva@brigade.com>