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.

  • flags is a combination of the git_diff_option_t values above
  • context_lines is the number of unchanged lines that define the boundary of a hunk (and to display before and after)
  • interhunk_lines is the maximum number of unchanged lines between hunk boundaries before the hunks will be merged into a one.
  • old_prefix is the virtual "directory" to prefix to old file names in hunk headers (default "a")
  • new_prefix is the virtual "directory" to prefix to new file names in hunk headers (default "b")
  • pathspec is an array of paths / fnmatch patterns to constrain diff
  • max_size is a file size (in bytes) above which a blob will be marked as binary automatically; pass a negative value to disable.
  • notify_cb is an optional callback function, notifying the consumer of changes to the diff as new deltas are added.
  • progress_cb is an optional callback function, notifying the consumer of which files are being examined as the diff is generated.
  • payload is the payload to pass to the callback functions.
  • ignore_submodules overrides the submodule ignore setting for all submodules in the diff.

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 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

defaults to GIT_DIFF_NORMAL

ignore_submodules

submodule ignore rule

pathspec

defaults to include all paths

notify_cb
progress_cb
void *
payload
uint32_t
context_lines

defaults to 3

uint32_t
interhunk_lines

defaults to 0

uint16_t
id_abbrev

default 'core.abbrev' or 7 if unset

max_size

defaults to 512MB

const char *
old_prefix

defaults to "a"

const char *
new_prefix

defaults to "b"

Parameter To

Versions