We were generating the term from the wrong object, meaning the system
was not keeping the object we should be. We were also not setting the
repository or increasing its refcount, meaning bad news when it came
time to GC the object.
While here, make the object be an elixir struct instead of delegating to
the erlang code.
As part of this, geef_nif:commit_tree() has been fixed to return the id,
insted of the type, as we know it's going to be a tree, but not then id.
Use erlang's allocator and simplify the code by writing into the
buffer we're going to give back anyway.
Also introduce a function to NUL-terminate iolist buffers, which can
avoid memory copying.