-
Notifications
You must be signed in to change notification settings - Fork 699
Description
I have made some breaking API changes on my branch. This is a WIP, but I'm showing early to get feedback early.
I'm investigating code generation instead of manually writing bindings libgit2. This branch code-gen's an easy class, GitOid, from a JSON description of the libgit2 interface. The JSON is based on the data from here, http://libgit2.github.com/libgit2/v0.18.0.json, but highly modified
IN THEORY you just mark methods as "async", "prototype", "constructor", etc. and it will "just work". It works for GitOid, all tests pass.
The new interface for the raw Oid is what I described:
var oid = git.raw.Oid.fromString("SHA1")
oid.sha() = ...
This API change has repercussions, changing some APIs to sync from async, as in Commit. ATM, the API is inconsistent, as Reference's sha() method is still async, because of indirect references. However, I propose to change the api to have have an IndirectReference class and a DirectReference class, with IndirectReference only having a resolve() method, and sha() being synchronous on DirectReference.
It is no longer possible to construct a raw Oid from scratch, as it would be in an invalid state; and further objects are now immutable.
Along the way I've identified what I believe to be memory leaks. I'm hoping to have the code-gen produce code without these leaks, if they are indeed real.