Build in libgit2 statically into git2go by default, removing the need
for the right version to be available as a shared object.
We do still need to link dynamically against OpenSSL and LibSSH2.
Go already has all the necessary pieces for encoding and decoding hex
strings. Using them let's us avoid going into C land.
Benchmarks show this takes about half the time as using libgit2's
functions.
This is the most common way of having an id that's not in Oid form, so
let's make it the "default" and rename to NewOidFromBytes() the one that
takes []byte.
There is no need for a struct with a single field. An Oid is 20 bytes
which hold the binary representation of the hash, so let's use that
directly. Go lets us have methods on this new type just the same.
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.
Don't name the return values, as they conflict with the names we want
inside and the types don't match what we want to have inside. We need
them to be two-way channels in the function, and then pass
unidirectional references to the different functions.
Unfortunately libgit2 sometimes returns an error without setting an
error message. Provide an alternative message instead of trying to
dereference nil.