Gracefully handle .git submodule files

It turns out that the `.git` directory can also be a file whose contents
point to another directory.

If users used this kind of `.git` file, Overcommit would fail
spectacularly. Add support for detecting this case and handling it
gracefully.

In the process, I noticed a number of tests depended on the `repo_root`
and `git_dir` helpers of the `Utils` module, so I extracted some code to
clear their internal caches before each example.

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