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 which files are being examined as the diff is generated
  • notify_payload is the payload data to pass to the notify_cb function

Signature

typedef struct git_diff_options { unsigned int version uint32_t flags uint16_t context_lines uint16_t interhunk_lines const char *old_prefix const char *new_prefix git_strarray pathspec git_off_t max_size git_diff_notify_cb notify_cb void *notify_payload };

Members

unsigned int
version

version for the struct

uint32_t
flags

defaults to GIT_DIFF_NORMAL

uint16_t
context_lines

defaults to 3

uint16_t
interhunk_lines

defaults to 0

const char *
old_prefix

defaults to "a"

const char *
new_prefix

defaults to "b"

pathspec

defaults to include all paths

max_size

defaults to 512MB

notify_cb
void *
notify_payload

Parameter To

Versions