libgit2

git_diff_tree_to_index

Version:

Create a diff list between a tree and repository index.

This is equivalent to git diff --cached <treeish> or if you pass the HEAD tree, then like git diff --cached.

The tree you pass will be used for the "old_file" side of the delta, and the index will be used for the "new_file" side of the delta.

Signature

int git_diff_tree_to_index(git_diff_list **diff, git_repository *repo, git_tree *old_tree, 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 containing the tree and index.

In
old_tree

A git_tree object to diff from, or NULL for empty tree.

In
index

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

In
opts

Structure with options to influence diff or NULL for defaults.

Returns

int

Versions