Create a diff list between a tree and the working directory.
The tree you provide will be used for the "old_file" side of the delta, and the working directory will be used for the "new_file" side.
Please note: this is NOT the same as git diff <treeish>
. Running
git diff HEAD
or the like actually uses information from the index,
along with the tree and working directory info.
This function returns strictly the differences between the tree and the files contained in the working directory, regardless of the state of files in the index. It may come as a surprise, but there is no direct equivalent in core git.
To emulate git diff <treeish>
, call both git_diff_tree_to_index
and
git_diff_index_to_workdir
, then call git_diff_merge
on the results.
That will yield a git_diff_list
that matches the git output.
If this seems confusing, take the case of a file with a staged deletion where the file has then been put back into the working dir and modified. The tree-to-workdir diff for that file is 'modified', but core git would show status 'deleted' since there is a pending deletion in the index.