This change makes all non-user-creatable structures non-comparable. This
makes it easier to add changes later that don't introduce breaking
changes from the go compatibility guarantees perspective.
This, of course, implies that this change _is_ a breaking change, but since
these structures are not intended to be created by users (or de-referenced),
it should be okay.
We can't work on the copies here, we need to have pointer receivers so we know
we're keeping alive the object whose finalizer would free the unmanaged memory
we're working with.
The existing `Commit.Message()` returns the trimmed commit message. In some cases
it is important to retrieve the exact commit message, even if it contains surrounding
newlines.
This adds a new `Commit.RawMessage()` to be able to do that.
An Object should be about representing a libgit2 object rather than
showing which methods it should support.
Change any return of Object to *Object and provide methods to convert
between this and the particular type.
Otherwise, the garbage collector might decide it's a good idea to throw
away the repository instance while the C object still has a pointer to
it. Hilarity ensues.
The library stores error information in thread-local storage, which
means we need to make sure that the Go runtime doesn't switch OS
threads between the time we call a function and th time we attempt to
retrieve the error information.
Provide a manual way of freeing objects, but set finalizers for them
in case the user does not want to worry about memory management, which
would be useful for commits or trees, which sare typically small.
When the objects are freed manually, the finalizer is unset to avoid
double-freeing, mimicking what the go runtime does.
It brings the data into go-land so we don't have to worry about the
commit being there. It stores the data we get from git and provides a
Time() function to get a time.Time struct.