This is the first release of the v0.25 series, "Rutschgefahr". The changelog follows.
Changes or improvements
- Fix repository discovery with
git_repository_discover
and
git_repository_open_ext
to match git's handling of a ceiling
directory at the current directory. git only checks ceiling
directories when its search ascends to a parent directory. A ceiling
directory matching the starting directory will not prevent git from
finding a repository in the starting directory or a parent directory. - Do not fail when deleting remotes in the presence of broken
global configs which contain branches. - Support for reading and writing git index v4 files
- Improve the performance of the revwalk and bring us closer to git's code.
- The reference db has improved support for concurrency and returns
GIT_ELOCKED
when an operation could not be performed due to locking. - Nanosecond resolution is now activated by default, following git's change to
do this. - We now restrict the set of ciphers we let OpenSSL use by default.
- Users can now register their own merge drivers for use with
.gitattributes
.
The library also gained built-in support for the union merge driver. - The default for creating references is now to validate that the object does
exist. - Add
git_proxy_options
which is used by the different networking
implementations to let the caller specify the proxy settings instead of
relying on the environment variables.
API additions
- You can now get the user-agent used by libgit2 using the
GIT_OPT_GET_USER_AGENT
option withgit_libgit2_opts()
.
It is the counterpart toGIT_OPT_SET_USER_AGENT
. - The
GIT_OPT_SET_SSL_CIPHERS
option forgit_libgit2_opts()
lets you specify
a custom list of ciphers to use for OpenSSL. git_commit_create_buffer()
creates a commit and writes it into a
user-provided buffer instead of writing it into the object db. Combine it with
git_commit_create_with_signature()
in order to create a commit with a
cryptographic signature.git_blob_create_fromstream()
and
git_blob_create_fromstream_commit()
allow you to create a blob by
writing into a stream. Useful when you do not know the final size or
want to copy the contents from another stream.- New flags for
git_repository_open_ext
:GIT_REPOSITORY_OPEN_NO_DOTGIT
- Do not check for a repository by
appending/.git
to thestart_path
; only open the repository if
start_path
itself points to the git directory.GIT_REPOSITORY_OPEN_FROM_ENV
- Find and open a git repository,
respecting the environment variables used by the git command-line
tools. If set,git_repository_open_ext
will ignore the other
flags and theceiling_dirs
argument, and will allow a NULL
path
to useGIT_DIR
or search from the current directory. The
search for a repository will respect$GIT_CEILING_DIRECTORIES
and$GIT_DISCOVERY_ACROSS_FILESYSTEM
. The opened repository
will respect$GIT_INDEX_FILE
,$GIT_NAMESPACE
,
$GIT_OBJECT_DIRECTORY
, and$GIT_ALTERNATE_OBJECT_DIRECTORIES
.
In the future, this flag will also causegit_repository_open_ext
to respect$GIT_WORK_TREE
and$GIT_COMMON_DIR
; currently,
git_repository_open_ext
with this flag will error out if either
$GIT_WORK_TREE
or$GIT_COMMON_DIR
is set.
git_diff_from_buffer()
can create agit_diff
object from the contents
of a git-style patch file.git_index_version()
andgit_index_set_version()
to get and set
the index versiongit_odb_expand_ids()
lets you check for the existence of multiple
objects at once.- The new
git_blob_dup()
,git_commit_dup()
,git_tag_dup()
and
git_tree_dup()
functions provide type-specific wrappers for
git_object_dup()
to reduce noise and increase type safety for callers. git_reference_dup()
lets you duplicate a reference to aid in ownership
management and cleanup.git_signature_from_buffer()
lets you create a signature from a string in the
format that appear in objects.git_tree_create_updated()
lets you create a tree based on another one
together with a list of updates. For the covered update cases, it's more
efficient than thegit_index
route.git_apply_patch()
applies hunks from agit_patch
to a buffer.git_diff_to_buf()
lets you print an entire diff directory to a buffer,
similar to howgit_patch_to_buf()
works.git_proxy_init_options()
is added to initialize agit_proxy_options
structure at run-time.git_merge_driver_register()
,git_merge_driver_unregister()
let you
register and unregister a custom merge driver to be used when.gitattributes
specifies it.git_merge_driver_lookup()
can be used to look up a merge driver by name.git_merge_driver_source_repo()
,git_merge_driver_source_ancestor()
,
git_merge_driver_source_ours()
,git_merge_driver_source_theirs()
,
git_merge_driver_source_file_options()
added as accessors to
git_merge_driver_source
.
API removals
git_blob_create_fromchunks()
has been removed in favour of
git_blob_create_fromstream()
.
Breaking API changes
git_packbuilder_object_count
andgit_packbuilder_written
now
return asize_t
instead of auint32_t
for more thorough
compatibility with the rest of the library.git_packbuiler_progress
now provides explicitly sizeduint32_t
values instead ofunsigned int
.git_diff_file
now includes anid_abbrev
field that reflects the
number of nibbles set in theid
field.git_odb_backend
now has afreshen
function pointer. This optional
function pointer is similar to theexists
function, but it will update
a last-used marker. For filesystem-based object databases, this updates
the timestamp of the file containing the object, to indicate "freshness".
If this isNULL
, then it will not be called and theexists
function
will be used instead.git_remote_connect()
now accepts proxy options.