cache.js refactor: Introduce a git module

This PR enables the standalone testing of our git processes while installing from git (see also, but not only #4667 - `Don't *always* fetch remote repositories of git-dependencies`)

It also factors out almost the whole process of fetching tarballs from git into an own module.

I am happy to rebase/squash this, but as there were some refactoring I leave the single commits for an easier review.

Notes:

 - I did not include locking in the module 
 - In the future we might want to return a stream with the tarball in `npm-cache-git` but it wasn't in the scope now