Is there a libgit2 API for this instead?