Description of changes to one entry.
When iterating over a diff list object, this will be passed to most callback functions and you can use the contents to understand exactly what has changed.
The old_file
represents the "from" side of the diff and the new_file
represents to "to" side of the diff. What those means depend on the
function that was used to generate the diff and will be documented below.
You can also use the GIT_DIFF_REVERSE
flag to flip it around.
Although the two sides of the delta are named "old_file" and "new_file", they actually may correspond to entries that represent a file, a symbolic link, a submodule commit id, or even a tree (if you are tracking type changes or ignored/untracked directories).
Under some circumstances, in the name of efficiency, not all fields will
be filled in, but we generally try to fill in as much as possible. One
example is that the "flags" field may not have either the BINARY
or the
NOT_BINARY
flag set to avoid examining file contents if you do not pass
in hunk and/or line callbacks to the diff foreach iteration function. It
will just use the git attributes for those files.
for RENAMED and COPIED, value 0-100