Top | Description | Object Hierarchy | ![]() |
![]() |
![]() |
![]() |
GgitDiff; struct GgitDiffClass; gint (*GgitDiffFileCallback) (GgitDiffDelta *delta
,gfloat progress
,gpointer user_data
); enum GgitDiffFlag; gint (*GgitDiffHunkCallback) (GgitDiffDelta *delta
,GgitDiffHunk *hunk
,gpointer user_data
); gint (*GgitDiffLineCallback) (GgitDiffDelta *delta
,GgitDiffHunk *hunk
,GgitDiffLine *line
,gpointer user_data
); enum GgitDiffLineType; enum GgitDiffFormatType; enum GgitDiffOption; GgitDiff * ggit_diff_new_tree_to_tree (GgitRepository *repository
,GgitTree *old_tree
,GgitTree *new_tree
,GgitDiffOptions *diff_options
,GError **error
); GgitDiff * ggit_diff_new_tree_to_index (GgitRepository *repository
,GgitTree *old_tree
,GgitIndex *index
,GgitDiffOptions *diff_options
,GError **error
); GgitDiff * ggit_diff_new_index_to_workdir (GgitRepository *repository
,GgitIndex *index
,GgitDiffOptions *diff_options
,GError **error
); GgitDiff * ggit_diff_new_tree_to_workdir (GgitRepository *repository
,GgitTree *old_tree
,GgitDiffOptions *diff_options
,GError **error
); void ggit_diff_merge (GgitDiff *onto
,GgitDiff *from
,GError **error
); void ggit_diff_foreach (GgitDiff *diff
,GgitDiffFileCallback file_cb
,GgitDiffHunkCallback hunk_cb
,GgitDiffLineCallback line_cb
,gpointer *user_data
,GError **error
); void ggit_diff_print (GgitDiff *diff
,GgitDiffFormatType type
,GgitDiffLineCallback print_cb
,gpointer *user_data
,GError **error
); void ggit_diff_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_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 +----GgitDiff
GFlags +----GgitDiffFlag
GEnum +----GgitDiffLineType
GEnum +----GgitDiffFormatType
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
,GgitDiffHunk *hunk
,gpointer user_data
);
Called for each hunk.
|
a GgitDiffDelta. |
|
a GgitDiffHunk. |
|
user-supplied data. [closure] |
Returns : |
0 to go continue or a GgitError in case there was an error. |
gint (*GgitDiffLineCallback) (GgitDiffDelta *delta
,GgitDiffHunk *hunk
,GgitDiffLine *line
,gpointer user_data
);
Called for each line.
|
a GgitDiffDelta. |
|
a GgitDiffHunk. |
|
a GgitDiffLine. |
|
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_FORMAT_PATCH = 1u, GGIT_DIFF_FORMAT_PATCH_HEADER = 2u, GGIT_DIFF_FORMAT_RAW = 3u, GGIT_DIFF_FORMAT_NAME_ONLY = 4u, GGIT_DIFF_FORMAT_NAME_STATUS = 5u } GgitDiffFormatType;
Possible output formats for diff data.
typedef enum { GGIT_DIFF_NORMAL = 0, GGIT_DIFF_REVERSE = 1u << 0, GGIT_DIFF_INCLUDE_IGNORED = 1u << 1, GGIT_DIFF_RECURSE_IGNORED_DIRS = 1u << 2, GGIT_DIFF_INCLUDE_UNTRACKED = 1u << 3, GGIT_DIFF_RECURSE_UNTRACKED_DIRS = 1u << 4, GGIT_DIFF_INCLUDE_UNMODIFIED = 1u << 5, GGIT_DIFF_INCLUDE_TYPECHANGE = 1u << 6, GGIT_DIFF_INCLUDE_TYPECHANGE_TREES = 1u << 7, GGIT_DIFF_IGNORE_FILE_MODE = 1u << 8, GGIT_DIFF_IGNORE_SUBMODULES = 1u << 9, GGIT_DIFF_IGNORE_CASE = 1u << 10, GGIT_DIFF_DISABLE_PATHSPEC_MATCH = 1u << 12, GGIT_DIFF_SKIP_BINARY_CHECK = 1u << 13, GGIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS = 1u << 14, GGIT_DIFF_FORCE_TEXT = 1u << 20, GGIT_DIFF_FORCE_BINARY = 1u << 21, GGIT_DIFF_IGNORE_WHITESPACE = 1u << 22, GGIT_DIFF_IGNORE_WHITESPACE_CHANGE = 1u << 23, GGIT_DIFF_IGNORE_WHITESPACE_EOL = 1u << 24, GGIT_DIFF_SHOW_UNTRACKED_CONTENT = 1u << 25, GGIT_DIFF_SHOW_UNMODIFIED = 1u << 26, GGIT_DIFF_PATIENCE = 1u << 28, GGIT_DIFF_MINIMAL = 1u << 29 } GgitDiffOption;
How the diff should be generated.
normal. | |
reverse the sides of the diff. | |
include ignored files. | |
also add all files under ignored dirs. | |
include untracked files. | |
recurse to untracked directories. | |
include unmodified files. | |
enable generation of typechange detal records. | |
try to label tree transitions as type changes. | |
ignore file mode changes. | |
ignore submodules. | |
use case insensitive filename comparison. | |
use exact path matching. | |
disable updating the binary flag in delta records. | |
immediately label untracked directories as untracked, without checking inside. | |
force text. | |
treat all files as binary, disabling text diffs. | |
ignore whitespace. | |
ignore whitespace change. | |
ignore whitespace at end-of-line. | |
include content of untracked files. this implies GGIT_DIFF_INCLUDE_UNTRACKED but not GGIT_DIFF_RECURSE_UNTRACKED_DIRS. | |
show unmodified files. | |
generate using the "patience diff" algorithm. | |
take extra time to find minimal diff. |
GgitDiff * ggit_diff_new_tree_to_tree (GgitRepository *repository
,GgitTree *old_tree
,GgitTree *new_tree
,GgitDiffOptions *diff_options
,GError **error
);
Creates a GgitDiff 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 GgitDiff if there was no error, NULL otherwise. |
GgitDiff * ggit_diff_new_tree_to_index (GgitRepository *repository
,GgitTree *old_tree
,GgitIndex *index
,GgitDiffOptions *diff_options
,GError **error
);
Creates a GgitDiff 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 GgitDiff if there was no error, NULL otherwise. |
GgitDiff * ggit_diff_new_index_to_workdir (GgitRepository *repository
,GgitIndex *index
,GgitDiffOptions *diff_options
,GError **error
);
Creates a GgitDiff 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 GgitDiff if there was no error, NULL otherwise. |
GgitDiff * ggit_diff_new_tree_to_workdir (GgitRepository *repository
,GgitTree *old_tree
,GgitDiffOptions *diff_options
,GError **error
);
Creates a GgitDiff 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 GgitDiff if there was no error, NULL otherwise. |
void ggit_diff_merge (GgitDiff *onto
,GgitDiff *from
,GError **error
);
Merges from
into onto
unless error
is set.
void ggit_diff_foreach (GgitDiff *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 GgitDiff. |
|
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_print (GgitDiff *diff
,GgitDiffFormatType type
,GgitDiffLineCallback print_cb
,gpointer *user_data
,GError **error
);
Iterates over diff
generating text output like "git diff".
|
a GgitDiff. |
|
a GgitDiffFormatType. |
|
a GgitDiffLineCallback. [scope call][closure user_data] |
|
callback user data. |
|
a GError for error reporting, or NULL . |
void ggit_diff_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_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_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 . |