libgit2

git_diff_options

Version:

Structure describing options about how the diff should be executed.

Setting all values of the structure to zero will yield the default values. Similarly, passing NULL for the options structure will give the defaults. The default values are marked below.

Signature

typedef struct git_diff_options { unsigned int version uint32_t flags git_submodule_ignore_t ignore_submodules git_strarray pathspec git_diff_notify_cb notify_cb git_diff_progress_cb progress_cb void *payload uint32_t context_lines uint32_t interhunk_lines git_oid_t oid_type uint16_t id_abbrev git_off_t max_size const char *old_prefix const char *new_prefix };

Members

unsigned int
version

version for the struct

uint32_t
flags

A combination of git_diff_option_t values above. Defaults to GIT_DIFF_NORMAL

ignore_submodules

Overrides the submodule ignore setting for all submodules in the diff.

pathspec

An array of paths / fnmatch patterns to constrain diff. All paths are included by default.

notify_cb

An optional callback function, notifying the consumer of changes to the diff as new deltas are added.

progress_cb

An optional callback function, notifying the consumer of which files are being examined as the diff is generated.

void *
payload

The payload to pass to the callback functions.

uint32_t
context_lines

The number of unchanged lines that define the boundary of a hunk (and to display before and after). Defaults to 3.

uint32_t
interhunk_lines

The maximum number of unchanged lines between hunk boundaries before the hunks will be merged into one. Defaults to 0.

oid_type

The object ID type to emit in diffs; this is used by functions that operate without a repository - namely git_diff_buffers, or git_diff_blobs and git_diff_blob_to_buffer when one blob is NULL.

This may be omitted (set to 0). If a repository is available, the object ID format of the repository will be used. If no repository is available then the default is GIT_OID_SHA.

If this is specified and a repository is available, then the specified oid_type must match the repository's object ID format.

uint16_t
id_abbrev

The abbreviation length to use when formatting object ids. Defaults to the value of 'core.abbrev' from the config, or 7 if unset.

max_size

A size (in bytes) above which a blob will be marked as binary automatically; pass a negative value to disable. Defaults to 512MB.

const char *
old_prefix

The virtual "directory" prefix for old file names in hunk headers. Default is "a".

const char *
new_prefix

The virtual "directory" prefix for new file names in hunk headers. Defaults to "b".

Parameter To

Versions