libgit2

git_diff_index_to_workdir

Version:

Create a diff list between the repository index and the workdir directory.

This matches the git diff command. See the note below on git_diff_tree_to_workdir for a discussion of the difference between git diff and git diff HEAD and how to emulate a git diff <treeish> using libgit2.

The index will be used for the "old_file" side of the delta, and the working directory will be used for the "new_file" side of the delta.

Signature

int git_diff_index_to_workdir(git_diff_list **diff, git_repository *repo, git_index *index, const git_diff_options *opts);

Parameters

In
diff

Output pointer to a git_diff_list pointer to be allocated.

In
repo

The repository.

In
index

The index to diff from; repo index used if NULL.

In
opts

Structure with options to influence diff or NULL for defaults.

Returns

int

Versions