Refactor classes

This changes the way memory is handled (so that only root level objects free themselves, all lower level objects expect to be freed by their parents because libgit 2 is weird). Also changes many methods like createCommit to create.
Added a test to revwalk to make sure there is no segfault, but wont run on travis/appveyor because it requires a node argument. Might be worth moving out anyways, as its not really a revwalk test, that was just the mechanism that originally broke it.