Struct git2::Diff

source · []
pub struct Diff<'repo> { /* private fields */ }
Expand description

The diff object that contains all individual file deltas.

This is an opaque structure which will be allocated by one of the diff generator functions on the Repository structure (e.g. diff_tree_to_tree or other diff_* functions).

Implementations

Merge one diff into another.

This merges items from the “from” list into the “self” list. The resulting diff will have all items that appear in either list. If an item appears in both lists, then it will be “merged” to appear as if the old version was from the “onto” list and the new version is from the “from” list (with the exception that if the item has a pending DELETE in the middle, then it will show as deleted).

Returns an iterator over the deltas in this diff.

Return the diff delta for an entry in the diff list.

Check if deltas are sorted case sensitively or insensitively.

Iterate over a diff generating formatted text output.

Returning false from the callback will terminate the iteration and return an error from this function.

Loop over all deltas in a diff issuing callbacks.

Returning false from any callback will terminate the iteration and return an error from this function.

Accumulate diff statistics for all patches.

Transform a diff marking file renames, copies, etc.

This modifies a diff in place, replacing old entries that look like renames or copies with new entries reflecting those changes. This also will, if requested, break modified files into add/remove pairs if the amount of change is above a threshold.

Create an e-mail ready patch from a diff.

Matches the format created by git format-patch

Create an patchid from a diff.

Read the contents of a git patch file into a git_diff object.

The diff object produced is similar to the one that would be produced if you actually produced it computationally by comparing two trees, however there may be subtle differences. For example, a patch file likely contains abbreviated object IDs, so the object IDs parsed by this function will also be abreviated.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.