![]() |
![]() |
![]() |
libgit2-glib Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
GgitDiffList; struct GgitDiffListClass; gint (*GgitDiffFileCallback) (GgitDiffDelta *delta
,gfloat progress
,gpointer user_data
); enum GgitDiffFlag; gint (*GgitDiffHunkCallback) (GgitDiffDelta *delta
,GgitDiffRange *range
,const gchar *header
,gsize header_len
,gpointer user_data
); gint (*GgitDiffLineCallback) (GgitDiffDelta *delta
,GgitDiffRange *range
,GgitDiffLineType line_type
,const gchar *content
,gsize content_len
,gpointer user_data
); enum GgitDiffLineType; enum GgitDiffOption; GgitDiffList * ggit_diff_list_new_tree_to_tree (GgitRepository *repository
,GgitTree *old_tree
,GgitTree *new_tree
,GgitDiffOptions *diff_options
,GError **error
); GgitDiffList * ggit_diff_list_new_tree_to_index (GgitRepository *repository
,GgitTree *old_tree
,GgitIndex *index
,GgitDiffOptions *diff_options
,GError **error
); GgitDiffList * ggit_diff_list_new_index_to_workdir (GgitRepository *repository
,GgitIndex *index
,GgitDiffOptions *diff_options
,GError **error
); GgitDiffList * ggit_diff_list_new_tree_to_workdir (GgitRepository *repository
,GgitTree *old_tree
,GgitDiffOptions *diff_options
,GError **error
); void ggit_diff_list_merge (GgitDiffList *onto
,GgitDiffList *from
,GError **error
); void ggit_diff_list_foreach (GgitDiffList *diff
,GgitDiffFileCallback file_cb
,GgitDiffHunkCallback hunk_cb
,GgitDiffLineCallback line_cb
,gpointer *user_data
,GError **error
); void ggit_diff_list_print_compact (GgitDiffList *diff
,GgitDiffLineCallback print_cb
,gpointer *user_data
,GError **error
); void ggit_diff_list_print_patch (GgitDiffList *diff
,GgitDiffLineCallback print_cb
,gpointer *user_data
,GError **error
); void ggit_diff_list_get_patch (GgitDiffList *diff
,gsize idx
,GgitDiffPatch **patch
,GgitDiffDelta **delta
,GError **error
); void ggit_diff_list_blobs (GgitBlob *old_blob
,const gchar *old_as_path
,GgitBlob *new_blob
,const gchar *new_as_path
,GgitDiffOptions *diff_options
,GgitDiffFileCallback file_cb
,GgitDiffHunkCallback hunk_cb
,GgitDiffLineCallback line_cb
,gpointer *user_data
,GError **error
); void ggit_diff_list_blob_to_buffer (GgitBlob *old_blob
,const gchar *old_as_path
,const gchar *buffer
,gsize buffer_len
,const gchar *buffer_as_path
,GgitDiffOptions *diff_options
,GgitDiffFileCallback file_cb
,GgitDiffHunkCallback hunk_cb
,GgitDiffLineCallback line_cb
,gpointer *user_data
,GError **error
);
GObject +----GgitObjectFactoryBase +----GgitNative +----GgitDiffList
GFlags +----GgitDiffFlag
GEnum +----GgitDiffLineType
GFlags +----GgitDiffOption
gint (*GgitDiffFileCallback) (GgitDiffDelta *delta
,gfloat progress
,gpointer user_data
);
Called for each file.
|
a GgitDiffDelta. |
|
the progress. |
|
user-supplied data. [closure] |
Returns : |
0 to go continue or a GgitError in case there was an error. |
typedef enum { GGIT_DIFF_FLAG_BINARY = 1 << 0, GGIT_DIFF_FLAG_NOT_BINARY = 1 << 1, GGIT_DIFF_FLAG_VALID_OID = 1 << 2 } GgitDiffFlag;
Describes the diff file and/or delta flags
gint (*GgitDiffHunkCallback) (GgitDiffDelta *delta
,GgitDiffRange *range
,const gchar *header
,gsize header_len
,gpointer user_data
);
Called for each hunk.
|
a GgitDiffDelta. |
|
a GgitDiffRange. |
|
the header. [array length=header_len][element-type guint8] |
|
the header length. |
|
user-supplied data. [closure] |
Returns : |
0 to go continue or a GgitError in case there was an error. |
gint (*GgitDiffLineCallback) (GgitDiffDelta *delta
,GgitDiffRange *range
,GgitDiffLineType line_type
,const gchar *content
,gsize content_len
,gpointer user_data
);
Called for each line.
|
a GgitDiffDelta. |
|
a GgitDiffRange. |
|
a GgitDiffLineType. |
|
the content. [array length=content_len][element-type guint8] |
|
the content length. |
|
user-supplied data. [closure] |
Returns : |
0 to go continue or a GgitError in case there was an error. |
typedef enum { GGIT_DIFF_LINE_CONTEXT = ' ', GGIT_DIFF_LINE_ADDITION = '+', GGIT_DIFF_LINE_DELETION = '-', GGIT_DIFF_LINE_CONTEXT_EOFNL = '=', GGIT_DIFF_LINE_ADD_EOFNL = '>', GGIT_DIFF_LINE_DEL_EOFNL = '<', GGIT_DIFF_LINE_FILE_HDR = 'F', GGIT_DIFF_LINE_HUNK_HDR = 'H', GGIT_DIFF_LINE_BINARY = 'B' } GgitDiffLineType;
These values describe where a line came from and will be passed to the GgitDiffLineCallback when iterating over a diff.
The GGIT_DIFF_LINE_FILE_HDR, GGIT_DIFF_LINE_HUNK_HDR and GGIT_DIFF_LINE_BINARY values are only sent when the diff is being printed.
line is part of the context. | |
line that was added. | |
line that was removed. | |
Both files have no LF at end. | |
LF was added at end of file. | |
LF was removed at end of file. | |
the file header. | |
the hunk header. | |
is binary. |
typedef enum { GGIT_DIFF_NORMAL = 0, GGIT_DIFF_REVERSE = 1 << 0, GGIT_DIFF_FORCE_TEXT = 1 << 1, GGIT_DIFF_IGNORE_WHITESPACE = 1 << 2, GGIT_DIFF_IGNORE_WHITESPACE_CHANGE = 1 << 3, GGIT_DIFF_IGNORE_WHITESPACE_EOL = 1 << 4, GGIT_DIFF_IGNORE_SUBMODULES = 1 << 5, GGIT_DIFF_PATIENCE = 1 << 6, GGIT_DIFF_INCLUDE_IGNORED = 1 << 7, GGIT_DIFF_INCLUDE_UNTRACKED = 1 << 8, GGIT_DIFF_INCLUDE_UNMODIFIED = 1 << 9, GGIT_DIFF_RECURSE_UNTRACKED_DIRS = 1 << 10 } GgitDiffOption;
How the diff should be generated.
normal. | |
reverse. | |
force text. | |
ignore whitespace. | |
ignore whitespace change. | |
ignore whitespace at end-of-line. | |
ignore submodules. | |
generate using the "patience diff" algorithm. | |
include ignored files. | |
include untracked files. | |
include unmodified files. | |
recurse to untracked directories. |
GgitDiffList * ggit_diff_list_new_tree_to_tree (GgitRepository *repository
,GgitTree *old_tree
,GgitTree *new_tree
,GgitDiffOptions *diff_options
,GError **error
);
Creates a GgitDiffList which compares old_tree
and new_tree
.
If diff_options
is NULL
then the defaults specified in
ggit_diff_options_new()
are used.
|
a GgitRepository. |
|
a GgitTree to diff from. [allow-none] |
|
a GgitTree to diff to. [allow-none] |
|
a GgitDiffOptions, or NULL . [allow-none]
|
|
a GError for error reporting, or NULL . |
Returns : |
a newly allocated GgitDiffList if there was no error, NULL otherwise. |
GgitDiffList * ggit_diff_list_new_tree_to_index (GgitRepository *repository
,GgitTree *old_tree
,GgitIndex *index
,GgitDiffOptions *diff_options
,GError **error
);
Creates a GgitDiffList which compares old_tree
and the index.
If index
is NULL
then repository
index is used.
If diff_options
is NULL
then the defaults specified in
ggit_diff_options_new()
are used.
|
a GgitRepository. |
|
a GgitTree to diff from. [allow-none] |
|
a GgitIndex, or NULL . [allow-none]
|
|
a GgitDiffOptions, or NULL . [allow-none]
|
|
a GError for error reporting, or NULL . |
Returns : |
a newly allocated GgitDiffList if there was no error, NULL otherwise. |
GgitDiffList * ggit_diff_list_new_index_to_workdir (GgitRepository *repository
,GgitIndex *index
,GgitDiffOptions *diff_options
,GError **error
);
Creates a GgitDiffList which compares the working directory and the index.
If index
is NULL
then repository
index is used.
If diff_options
is NULL
then the defaults specified in
ggit_diff_options_new()
are used.
|
a GgitRepository. |
|
a GgitIndex, or NULL . [allow-none]
|
|
a GgitDiffOptions, or NULL . [allow-none]
|
|
a GError for error reporting, or NULL . |
Returns : |
a newly allocated GgitDiffList if there was no error, NULL otherwise. |
GgitDiffList * ggit_diff_list_new_tree_to_workdir (GgitRepository *repository
,GgitTree *old_tree
,GgitDiffOptions *diff_options
,GError **error
);
Creates a GgitDiffList which compares the working directory and old_tree
.
If diff_options
is NULL
then the defaults specified in
ggit_diff_options_new()
are used.
|
a GgitRepository. |
|
a GgitTree to diff from. [allow-none] |
|
a GgitDiffOptions, or NULL . [allow-none]
|
|
a GError for error reporting, or NULL . |
Returns : |
a newly allocated GgitDiffList if there was no error, NULL otherwise. |
void ggit_diff_list_merge (GgitDiffList *onto
,GgitDiffList *from
,GError **error
);
Merges from
into onto
unless error
is set.
|
the GgitDiffList to merge into. |
|
the GgitDiffList to merge. |
|
a GError for error reporting, or NULL . |
void ggit_diff_list_foreach (GgitDiffList *diff
,GgitDiffFileCallback file_cb
,GgitDiffHunkCallback hunk_cb
,GgitDiffLineCallback line_cb
,gpointer *user_data
,GError **error
);
Iterates over the diff calling file_cb
, hunk_cb
and line_cb
.
|
a GgitDiffList. |
|
a GgitDiffFileCallback. [allow-none][scope call][closure user_data] |
|
a GgitDiffHunkCallback. [allow-none][scope call][closure user_data] |
|
a GgitDiffLineCallback. [allow-none][scope call][closure user_data] |
|
callback user data. |
|
a GError for error reporting, or NULL . |
void ggit_diff_list_print_compact (GgitDiffList *diff
,GgitDiffLineCallback print_cb
,gpointer *user_data
,GError **error
);
Iterates over diff
generating text output like "git diff --name-status".
|
a GgitDiffList. |
|
a GgitDiffLineCallback. [scope call][closure user_data] |
|
callback user data. |
|
a GError for error reporting, or NULL . |
void ggit_diff_list_print_patch (GgitDiffList *diff
,GgitDiffLineCallback print_cb
,gpointer *user_data
,GError **error
);
Iterates over diff
generating text output like "git diff".
|
a GgitDiffList. |
|
a GgitDiffLineCallback. [scope call][closure user_data] |
|
callback user data. |
|
a GError for error reporting, or NULL . |
void ggit_diff_list_get_patch (GgitDiffList *diff
,gsize idx
,GgitDiffPatch **patch
,GgitDiffDelta **delta
,GError **error
);
Gets the diff delta and patch for an entry in diff
.
The GgitDiffPatch is a newly created object contains the text diffs
for the delta. You have to call git_diff_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.
For an unchanged file or a binary file, no GgitDiffPatch will be
created, the output will be set to NULL
, and the `binary` flag will be
set true in delta
.
It is okay to pass NULL
for either of the output parameters; if you pass
NULL
for patch
, then the text diff will not be calculated.
|
a GgitDiffList. |
|
index into diff . |
|
a GgitDiffPatch or NULL . [allow-none]
|
|
a GgitDiffDelta or NULL . [allow-none]
|
|
a GError for error reporting, or NULL . |
void ggit_diff_list_blobs (GgitBlob *old_blob
,const gchar *old_as_path
,GgitBlob *new_blob
,const gchar *new_as_path
,GgitDiffOptions *diff_options
,GgitDiffFileCallback file_cb
,GgitDiffHunkCallback hunk_cb
,GgitDiffLineCallback line_cb
,gpointer *user_data
,GError **error
);
Iterates over the diff calling file_cb
, hunk_cb
and line_cb
.
The GgitDiffFile mode always be 0, path will be NULL
and when a blob is
NULL
the oid will be 0.
If diff_options
is NULL
then the defaults specified in
ggit_diff_options_new()
are used.
|
a GgitBlob to diff from. [allow-none] |
|
treat old_blob as if it had this filename, or NULL ,. [allow-none]
|
|
a GgitBlob to diff to. [allow-none] |
|
treat new_blob as if it had this filename, or NULL ,. [allow-none]
|
|
a GgitDiffOptions, or NULL . [allow-none]
|
|
a GgitDiffFileCallback. [allow-none][scope call][closure user_data] |
|
a GgitDiffHunkCallback. [allow-none][scope call][closure user_data] |
|
a GgitDiffLineCallback. [allow-none][scope call][closure user_data] |
|
callback user data. |
|
a GError for error reporting, or NULL . |
void ggit_diff_list_blob_to_buffer (GgitBlob *old_blob
,const gchar *old_as_path
,const gchar *buffer
,gsize buffer_len
,const gchar *buffer_as_path
,GgitDiffOptions *diff_options
,GgitDiffFileCallback file_cb
,GgitDiffHunkCallback hunk_cb
,GgitDiffLineCallback line_cb
,gpointer *user_data
,GError **error
);
Same as ggit_diff_list_blobs()
but using a buffer.
|
a GgitBlob to diff from. [allow-none] |
|
treat old_blob as if it had this filename, or NULL ,. [allow-none]
|
|
a buffer to diff to. [allow-none][array length=buffer_len] |
|
length of buffer . |
|
treat buffer as if it had this filename, or NULL ,. [allow-none]
|
|
a GgitDiffOptions, or NULL . [allow-none]
|
|
a GgitDiffFileCallback. [allow-none][scope call][closure user_data] |
|
a GgitDiffHunkCallback. [allow-none][scope call][closure user_data] |
|
a GgitDiffLineCallback. [allow-none][scope call][closure user_data] |
|
callback user data. |
|
a GError for error reporting, or NULL . |