Most callers only need to _get_ error messages. Only callers implemented
more complicated functions (like a custom ODB for example) need to set
them.
(Callback users should likely ferry their own error information in their
callback payload.)
Provide two memory-backed configuration backends -- one that takes a
string in config file format `[section] key=value` and one that takes a
list of strings in `section.key=value` format.
A git_config_entry now knows the type of the origin for the entry
("file", "memory", etc) and the path details (for files, the path on
disk). This is propagated through snapshots.
The opaque `payload` on an entry is unnecessary and distracting; config
entries should follow the patterns of other objects and use space
elsewhere in the structure with a "base" config entry struct embedded.
Remove the number of functions that custom allocator users need to
provide; nobody should need to implement `substrdup`. Keep it to the
basics that are actually _needed_ for allocation (malloc, realloc,
free) and reimplement the rest ourselves.
In addition, move the failure check and error setting _out_ of the
custom allocators and into a wrapper so that users don't need to deal
with this. This also allows us to call our allocator (without the
wrapper) early so that it does not try to set an error on failure, which
may be important for bootstrapping.
Make socket I/O non-blocking and add optional timeouts.
Users may now set `GIT_OPT_SET_SERVER_CONNECT_TIMEOUT` to set a shorter
connection timeout. (The connect timeout cannot be longer than the
operating system default.) Users may also now configure the socket read
and write timeouts with `GIT_OPT_SET_SERVER_TIMEOUT`.
By default, connects still timeout based on the operating system
defaults (typically 75 seconds) and socket read and writes block.
Add a test against our custom testing git server that ensures that we
can timeout reads against a slow server.
git_oid_tostr_s could fail if thread-local state initialization fails.
In that case, it will now return `NULL`. Callers should check for
`NULL` and propagate the failure.
Users should provide us an array of object ids; we don't need a separate
type. And especially, we should not be mutating user-providing values.
Instead, use `git_oid *` in the shallow code.
This improves the documentation for `git_repository_is_empty`
which currently does not accurately describe libgit2's definition
of "empty".
It says that HEAD must point to the "unborn master branch", when
in fact, this is not the case if the repo's `init.defaultBranch`
configuration is set. If it is set, it will check that HEAD points
there. Only if it is not set does it fall back to `master`.
`git_odb_stream` should have an `oid_type` to disambiguate; that's not
necessary on non-experimental SHA256 builds. Avoid unnecessary ABI
breakage for consumers and hide it behind an ifdef for now.
`git_strarray_copy` is deprecated (and has been included in
`deprecated.h` for some time). It should not have remained in
the public `strarray.h`. Remove it.
Some callers -- like our test suite and the test suites of our language
bindings -- want to isolate the home directory to avoid accidentally
including the executing user's actual home directory data.
Previously, we combined the notion of a home directory and global
configuration -- now that this is separated, we provide users the
ability to configure both.
Not everybody builds libgit2 using cmake; provide an `experimental.h`
with no experiments configured for those that do not. To support this,
we also now create compile definitions for experimental functionality,
to supplant that empty `experimental.h`. cmake will continue to generate
the proper `experimental.h` file for use with `make install`.