### Struct

# Ggit Patch

#### Description [src]

    struct GgitPatch {
      /* No available fields */
    }

Represents a patch object.

#### Constructors

###### ggit_patch_new_from_blobs

Directly generate a patch from the difference between two blobs.

###### ggit_patch_new_from_diff

The `GgitPatch` is a newly created object contains the text diffs for the delta. You have to call `ggit_patch_unref()` when you are done with it. You can use the patch object to loop over all the hunks and lines in the diff of the one delta.

#### Instance methods

###### ggit_patch_get_delta

Get the diff delta corresponding to the patch.

###### ggit_patch_get_hunk

Get the `idx`‘th hunk in the patch.

###### ggit_patch_get_line_stats

Get the line statistics of the patch.

###### ggit_patch_get_num_hunks

Get the number of hunks in the patch.

###### ggit_patch_get_num_lines_in_hunk

Get the number of lines in `hunk`.

###### ggit_patch_ref

Atomically increments the reference count of `patch` by one. This function is MT-safe and may be called from any thread.

###### ggit_patch_to_stream

Write the contents of a patch to the provided stream.

###### ggit_patch_to_string

Gets the content of a patch as a single diff text.

###### ggit_patch_unref

Atomically decrements the reference count of `patch` by one. If the reference count drops to 0, `patch` is freed.