Ported gitfs cache fixes from #7749 into hgfs. refs #3665.
Merge pull request #7777 from shadowfax-chc/develop

Ported gitfs cache fixes from #7749 into hgfs. refs #3665.