Top |
Functions
GgitDiffDelta * | ggit_patch_get_delta () |
GgitDiffHunk * | ggit_patch_get_hunk () |
gboolean | ggit_patch_get_line_stats () |
gsize | ggit_patch_get_num_hunks () |
gint | ggit_patch_get_num_lines_in_hunk () |
GgitPatch * | ggit_patch_new_from_blobs () |
GgitPatch * | ggit_patch_new_from_diff () |
GgitPatch * | ggit_patch_ref () |
gboolean | ggit_patch_to_stream () |
gchar * | ggit_patch_to_string () |
void | ggit_patch_unref () |
Functions
ggit_patch_get_delta ()
GgitDiffDelta *
ggit_patch_get_delta (GgitPatch *patch
);
Get the diff delta corresponding to the patch.
ggit_patch_get_hunk ()
GgitDiffHunk * ggit_patch_get_hunk (GgitPatch *patch
,gsize idx
,GError **error
);
Get the idx
'th hunk in the patch.
ggit_patch_get_line_stats ()
gboolean ggit_patch_get_line_stats (GgitPatch *patch
,gsize *total_context
,gsize *total_additions
,gsize *total_deletions
,GError **error
);
Get the line statistics of the patch.
Parameters
patch |
a GgitPatch. |
|
total_context |
return value for the number of context lines. |
[allow-none][out] |
total_additions |
return value for the number of added lines. |
[allow-none][out] |
total_deletions |
return value for the number of deleted lines. |
[allow-none][out] |
error |
a GError. |
ggit_patch_get_num_hunks ()
gsize
ggit_patch_get_num_hunks (GgitPatch *patch
);
Get the number of hunks in the patch.
ggit_patch_get_num_lines_in_hunk ()
gint ggit_patch_get_num_lines_in_hunk (GgitPatch *patch
,gsize hunk
);
Get the number of lines in hunk
.
ggit_patch_new_from_blobs ()
GgitPatch * ggit_patch_new_from_blobs (GgitBlob *old_blob
,const gchar *old_as_path
,GgitBlob *new_blob
,const gchar *new_as_path
,GgitDiffOptions *diff_options
,GError **error
);
Directly generate a patch from the difference between two blobs.
This is just like ggit_diff_blobs()
except it generates a patch object
for the difference instead of directly making callbacks. You can use the
standard ggit_patch accessor functions to read the patch data, and
you must call ggit_patch_unref on the patch when done.
Parameters
old_blob |
a GgitBlob to diff from. |
[allow-none] |
old_as_path |
treat |
[allow-none] |
new_blob |
a GgitBlob to diff to. |
[allow-none] |
new_as_path |
treat |
[allow-none] |
diff_options |
a GgitDiffOptions, or |
[allow-none] |
error |
a GError for error reporting, or |
ggit_patch_new_from_diff ()
GgitPatch * ggit_patch_new_from_diff (GgitDiff *diff
,gsize idx
,GError **error
);
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.
ggit_patch_ref ()
GgitPatch *
ggit_patch_ref (GgitPatch *patch
);
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 ()
gboolean ggit_patch_to_stream (GgitPatch *patch
,GOutputStream *stream
,GError **error
);
Write the contents of a patch to the provided stream.
ggit_patch_to_string ()
gchar * ggit_patch_to_string (GgitPatch *patch
,GError **error
);
Gets the content of a patch as a single diff text.