Fix Git caching

This was forked from [tylerflint:master](https://github.com/tylerflint/berkshelf).  Tyler recently worked on fixing the Git caching bug, but there were still some issues.  His pull request is [here](https://github.com/RiotGames/berkshelf/pull/429).

I've tested it locally, but I don't have access to a Chef server to run the unit tests.  Can someone take a look and let me know if there are any problems?

Thanks,
Jason