v0.23.0
This is the first release of the v0.23 series, "Entschuldigung", with many fixes and new features since v0.22.
The largest changes are to the handling of remotes and submodules. We no longer treat them as ORM-like objects, but model the way the Git configuration is updated more closely. These objects now keep their state as of the lookup/refresh time and they're not shared across lookups.
The changelog follows.
Changes or improvements
- Patience and minimal diff drivers can now be used for merges.
- Merges can now ignore whitespace changes.
- Updated binary identification in CRLF filtering to avoid false positives in
UTF-8 files. - Rename and copy detection is enabled for small files.
- Checkout can now handle an initial checkout of a repository, making
GIT_CHECKOUT_SAFE_CREATE
unnecessary for users of clone. - The signature parameter in the ref-modifying functions has been
removed. Usegit_repository_set_ident()
and
git_repository_ident()
to override the signature to be used. - The local transport now auto-scales the number of threads to use
when creating the packfile instead of sticking to one. - Reference renaming now uses the right id for the old value.
- The annotated version of branch creation, HEAD detaching and reset
allow for specifying the expression from the user to be put into the
reflog. git_rebase_commit
now returnsGIT_EUNMERGED
when you attempt to
commit with unstaged changes.- On Mac OS X, we now use SecureTransport to provide the cryptographic
support for HTTPS connections insead of OpenSSL. - Checkout can now accept an index for the baseline computations via the
baseline_index
member. - The configuration for fetching is no longer stored inside the
git_remote
struct but has been moved to agit_fetch_options
. The
remote functions now take these options or the callbacks instead of
setting them beforehand. git_submodule
instances are no longer cached or shared across
lookup. Each submodule represents the configuration at the time of
loading.- The index now uses diffs for
add_all()
andupdate_all()
which
gives it a speed boost and closer semantics to git. - The ssh transport now reports the stderr output from the server as
the error message, which allows you to get the "repository not
found" messages. git_index_conflict_add()
will remove staged entries that exist for
conflicted paths.- The flags for a
git_diff_file
will now have theGIT_DIFF_FLAG_EXISTS
bit set when a file exists on that side of the diff. This is useful
for understanding whether a side of the diff exists in the presence of
a conflict. - The constructor for a write-stream into the odb now takes
git_off_t
instead ofsize_t
for the size of the blob, which
allows putting large files into the odb on 32-bit systems. - The remote's push and pull URLs now honor the url.$URL.insteadOf
configuration. This allows modifying URL prefixes to a custom
value via gitconfig. git_diff_foreach
,git_diff_blobs
,git_diff_blob_to_buffer
,
andgit_diff_buffers
now accept a new binary callback of type
git_diff_binary_cb
that includes the binary diff information.- The race condition mitigations described in
racy-git.txt
have been
implemented. - If libcurl is installed, we will use it to connect to HTTP(S)
servers.
API additions
- The
git_merge_options
gained afile_flags
member. - Parsing and retrieving a configuration value as a path is exposed
viagit_config_parse_path()
andgit_config_get_path()
respectively. git_repository_set_ident()
andgit_repository_ident()
serve to
set and query which identity will be used when writing to the
reflog.git_config_entry_free()
frees a config entry.git_config_get_string_buf()
provides a way to safely retrieve a
string from a non-snapshot configuration.git_annotated_commit_from_revspec()
allows to get an annotated
commit from an extended sha synatx string.git_repository_set_head_detached_from_annotated()
,
git_branch_create_from_annotated()
and
git_reset_from_annotated()
allow for the caller to provide an
annotated commit through which they can control what expression is
put into the reflog as the source/target.git_index_add_frombuffer()
can now create a blob from memory
buffer and add it to the index which is attached to a repository.- The structure
git_fetch_options
has been added to determine the
runtime configuration for fetching, such as callbacks, pruning and
autotag behaviour. It has the runtime initializer
git_fetch_init_options()
. - The enum
git_fetch_prune_t
has been added, letting you specify the
pruning behaviour for a fetch. - A push operation will notify the caller of what updates it indends
to perform on the remote, which provides similar information to
git's pre-push hook. git_stash_apply()
can now apply a stashed state from the stash list,
placing the data into the working directory and index.git_stash_pop()
will apply a stashed state (likegit_stash_apply()
)
but will remove the stashed state after a successful application.- A new error code
GIT_EEOF
indicates an early EOF from the
server. This typically indicates an error with the URL or
configuration of the server, and tools can use this to show messages
about failing to communicate with the server. - A new error code
GIT_EINVALID
indicates that an argument to a
function is invalid, or an invalid operation was requested. git_diff_index_to_workdir()
andgit_diff_tree_to_index()
will now
produce deltas of typeGIT_DELTA_CONFLICTED
to indicate that the index
side of the delta is a conflict.- The
git_status
family of functions will now produce status of type
GIT_STATUS_CONFLICTED
to indicate that a conflict exists for that file
in the index. git_index_entry_is_conflict()
is a utility function to determine if
a given index entry has a non-zero stage entry, indicating that it is
one side of a conflict.- It is now possible to pass a keypair via a buffer instead of a
path. For this,GIT_CREDTYPE_SSH_MEMORY
and
git_cred_ssh_key_memory_new()
have been added. git_filter_list_contains
will indicate whether a particular
filter will be run in the given filter list.git_commit_header_field()
has been added, which allows retrieving
the contents of an arbitrary header field.git_submodule_set_branch()
allows to set the configured branch for
a submodule.
API removals
git_remote_save()
andgit_remote_clear_refspecs()
have been
removed. Remote's configuration is changed via the configuration
directly or through a convenience function which performs changes to
the configuration directly.git_remote_set_callbacks()
,git_remote_get_callbacks()
and
git_remote_set_transport()
have been removed and the remote no
longer stores this configuration.git_remote_set_fetch_refpecs()
and
git_remote_set_push_refspecs()
have been removed. There is no
longer a way to set the base refspecs at run-time.git_submodule_save()
has been removed. The submodules are no
longer configured via the objects.git_submodule_reload_all()
has been removed as we no longer cache
submodules.
Breaking API changes
git_smart_subtransport_cb
now has aparam
parameter.- The
git_merge_options
structure memberflags
has been renamed
totree_flags
. - The
git_merge_file_options
structure memberflags
is now
an unsigned int. It was previously agit_merge_file_flags_t
. GIT_CHECKOUT_SAFE_CREATE
has been removed. Most users will generally
be able to switch toGIT_CHECKOUT_SAFE
, but if you require missing
file handling during checkout, you may now useGIT_CHECKOUT_SAFE | GIT_CHECKOUT_RECREATE_MISSING
.- The
git_clone_options
andgit_submodule_update_options
structures no longer have asignature
field. - The following functions have removed the signature and/or log message
parameters in favour of git-emulating ones.git_branch_create()
,git_branch_move()
git_rebase_init()
,git_rebase_abort()
git_reference_symbolic_create_matching()
,
git_reference_symbolic_create()
,git_reference_create()
,
git_reference_create_matching()
,
git_reference_symbolic_set_target()
,
git_reference_set_target()
,git_reference_rename()
git_remote_update_tips()
,git_remote_fetch()
,git_remote_push()
git_repository_set_head()
,
git_repository_set_head_detached()
,
git_repository_detach_head()
git_reset()
git_config_get_entry()
now gives back a ref-counted
git_config_entry
. You must free it when you no longer need it.git_config_get_string()
will return an error if used on a
non-snapshot configuration, as there can be no guarantee that the
returned pointer is valid.git_note_default_ref()
now uses agit_buf
to return the string,
as the string is otherwise not guaranteed to stay allocated.git_rebase_operation_current()
will returnGIT_REBASE_NO_OPERATION
if it is called immediately after creating a rebase session but before
you have applied the first patch.git_rebase_options
now contains agit_checkout_options
struct
that will be used for functions that modify the working directory,
namelygit_checkout_init
,git_checkout_next
and
git_checkout_abort
. As a result,git_rebase_open
now also takes
agit_rebase_options
and only thegit_rebase_init
and
git_rebase_open
functions take agit_rebase_options
, where they
will persist the options to subsequentgit_rebase
calls.- The
git_clone_options
struct now has fetch options in a
fetch_opts
field instead of remote callbacks in
remote_callbacks
. - The remote callbacks has gained a new member
push_negotiation
which gets called before sending the update commands to the server. - The following functions no longer act on a remote instance but
change the repository's configuration. Their signatures have changed
accordingly:git_remote_set_url()
,git_remote_seturl()
git_remote_add_fetch()
,git_remote_add_push()
andgit_remote_set_autotag()
git_remote_connect()
andgit_remote_prune()
now take a pointer
to the callbacks.git_remote_fetch()
andgit_remote_download()
now take a pointer
to fetch options which determine the runtime configuration.- The
git_remote_autotag_option_t
values have been changed. It has
gained a_UNSPECIFIED
default value to specify no override for the
configured setting. git_remote_update_tips()
now takes a pointer to the callbacks as
well as a boolean whether to writeFETCH_HEAD
and the autotag
setting.git_remote_create_anonymous()
no longer takes a fetch refspec as
url-only remotes cannot have configured refspecs.- The
git_submodule_update_options
struct now has fetch options in
thefetch_opts
field instead of callbacks in the
remote_callbacks
field. - The following functions no longer act on a submodule instance but
change the repository's configuration. Their signatures have changed
accordingly:git_submodule_set_url()
,git_submodule_set_ignore()
,
git_submodule_set_update()
,
git_submodule_set_fetch_recurse_submodules()
.
git_submodule_status()
no longer takes a submodule instance but a
repsitory, a submodule name and an ignore setting.- The
push
function in thegit_transport
interface now takes a
pointer to the remote callbacks. - The
git_index_entry
struct's fields' types have been changed to
more accurately reflect what is in fact stored in the
index. Specifically, time and file size are 32 bits intead of 64, as
these values are truncated. GIT_EMERGECONFLICT
is nowGIT_ECONFLICT
, which more accurately
describes the nature of the error.- It is no longer allowed to call
git_buf_grow()
on buffers
borrowing the memory they point to.