Starting Integrating libgit2 API

Well, it may or may not be an improvement.

At least part of it doesn't depend on the command line.