Workaround git 2 issue with fetching remote hashes

sub-optimal, as it will access the network twice, but it should be more robust,
and well, it's a workaround...
Merge pull request #1858 from OCamlPro/git-hashes

Workaround git 2 issue with fetching remote hashes