Fix test suite

This series of patches fix all issues I had running the test suite on OS X, including a fix for a recent change in upstream (libgit2/libgit2@052a2ffde4d8cf0d2b07c70956631d97875ad5ec).