| layout |
default |
| menu_item |
api |
| title |
Diff |
| description |
Version 0.26.1 |
| return_to |
| API Documentation Index |
/api/ |
|
| sections |
| blobToBuffer |
fromBuffer |
indexToIndex |
indexToWorkdir |
treeToIndex |
treeToTree |
treeToWorkdir |
treeToWorkdirWithIndex |
#findSimilar |
#getDelta |
#getPerfdata |
#getStats |
#isSortedIcase |
#merge |
#numDeltas |
#patches |
#patchid |
#toBuf |
DELTA |
FIND |
FLAG |
FORMAT |
FORMAT_EMAIL_FLAGS |
LINE |
OPTION |
STATS_FORMAT |
#blobToBuffer |
#fromBuffer |
#indexToIndex |
#indexToWorkdir |
#treeToIndex |
#treeToTree |
#treeToWorkdir |
#treeToWorkdirWithIndex |
#findSimilar |
#getDelta |
#getPerfdata |
#getStats |
#isSortedIcase |
#merge |
#numDeltas |
#patches |
#patchid |
#toBuf |
#DELTA |
#FIND |
#FLAG |
#FORMAT |
#FORMAT_EMAIL_FLAGS |
#LINE |
#OPTION |
#STATS_FORMAT |
|
Diff.blobToBuffer(old_blob, old_as_path, buffer, buffer_as_path, opts, file_cb, binary_cb, hunk_cb, line_cb).then(function() {
// method complete});
Directly run a diff between a blob and a buffer.
| Parameters |
Type |
|
| old_blob |
Blob |
Blob for old side of diff, or NULL for empty blob |
| old_as_path |
String |
Treat old blob as if it had this filename; can be NULL |
| buffer |
String |
Raw data for new side of diff, or NULL for empty |
| buffer_as_path |
String |
Treat buffer as if it had this filename; can be NULL |
| opts |
DiffOptions |
Options for diff, or NULL for default options |
| file_cb |
Function |
Callback for "file"; made once if there is a diff; can be NULL |
| binary_cb |
Function |
Callback for binary files; can be NULL |
| hunk_cb |
Function |
Callback for each hunk in diff; can be NULL |
| line_cb |
Function |
Callback for each line in diff; can be NULL |
Diff.fromBuffer(content, content_len).then(function(diff) {
// Use diff
});
| Parameters |
Type |
|
| content |
String |
The contents of a patch file |
| content_len |
Number |
The length of the patch file contents |
Diff.indexToIndex(repo, old_index, new_index, opts).then(function(diff) {
// Use diff
});
| Parameters |
Type |
|
| repo |
Repository |
The repository containing the indexes. |
| old_index |
Index |
A git_index object to diff from. |
| new_index |
Index |
A git_index object to diff to. |
| opts |
DiffOptions |
Structure with options to influence diff or NULL for defaults. |
Diff.indexToWorkdir Async
Diff.indexToWorkdir(repo, index, opts).then(function(diff) {
// Use diff
});
| Parameters |
Type |
|
| repo |
Repository |
The repository. |
| index |
Index |
The index to diff from; repo index used if NULL. |
| opts |
DiffOptions |
Structure with options to influence diff or NULL for defaults. |
Diff.treeToIndex(repo, old_tree, index, opts).then(function(diff) {
// Use diff
});
| Parameters |
Type |
|
| repo |
Repository |
The repository containing the tree and index. |
| old_tree |
Tree |
A git_tree object to diff from, or NULL for empty tree. |
| index |
Index |
The index to diff with; repo index used if NULL. |
| opts |
DiffOptions |
Structure with options to influence diff or NULL for defaults. |
Diff.treeToTree(repo, old_tree, new_tree, opts).then(function(diff) {
// Use diff
});
| Parameters |
Type |
|
| repo |
Repository |
The repository containing the trees. |
| old_tree |
Tree |
A git_tree object to diff from, or NULL for empty tree. |
| new_tree |
Tree |
A git_tree object to diff to, or NULL for empty tree. |
| opts |
DiffOptions |
Structure with options to influence diff or NULL for defaults. |
Diff.treeToWorkdir(repo, old_tree, opts).then(function(diff) {
// Use diff
});
| Parameters |
Type |
|
| repo |
Repository |
The repository containing the tree. |
| old_tree |
Tree |
A git_tree object to diff from, or NULL for empty tree. |
| opts |
DiffOptions |
Structure with options to influence diff or NULL for defaults. |
Diff.treeToWorkdirWithIndex Async
Diff.treeToWorkdirWithIndex(repo, old_tree, opts).then(function(diff) {
// Use diff
});
| Parameters |
Type |
|
| repo |
Repository |
The repository containing the tree. |
| old_tree |
Tree |
A git_tree object to diff from, or NULL for empty tree. |
| opts |
DiffOptions |
Structure with options to influence diff or NULL for defaults. |
diff.findSimilar(options).then(function(result) {
// Use result
});
| Parameters | Type |
| --- | --- | --- |
| options | DiffFindOptions | Control how detection should be run, NULL for defaults |
| Returns |
|
| Number |
0 on success, -1 on failure |
var diffDelta = diff.getDelta(idx);
| Parameters | Type |
| --- | --- | --- |
| idx | Number | Index into diff list |
var diffPerfdata = diff.getPerfdata();
diff.getStats().then(function(diffStats) {
// Use diffStats
});
| Returns |
|
| DiffStats |
Structure containg the diff statistics. |
var result = diff.isSortedIcase();
| Returns |
|
| Number |
0 if case sensitive, 1 if case is ignored |
diff.merge(from).then(function(result) {
// Use result
});
| Parameters | Type |
| --- | --- | --- |
| from | Diff | Diff to merge. |
var result = diff.numDeltas();
| Returns |
|
| Number |
Count of number of deltas in the list |
diff.patches().then(function(arrayConvenientPatch) {
// Use arrayConvenientPatch
});
Retrieve patches in this difflist
| Returns |
|
| Array<ConvenientPatch> |
a promise that resolves to an array of ConvenientPatches |
diff.patchid(opts).then(function(oid) {
// Use oid
});
| Parameters | Type |
| --- | --- | --- |
| opts | DiffPatchidOptions | Options for how to calculate the patch ID. This is intended for future changes, as currently no options are available. |
diff.toBuf(format).then(function(buf) {
// Use buf
});
| Parameters | Type |
| --- | --- | --- |
| format | Number | A git_diff_format_t value to pick the text format. |
| Returns |
|
| Buf |
a user-allocated git_buf that will |
| Flag | Value |
| --- | --- | --- |
| Diff.DELTA.UNMODIFIED | 0 |
| Diff.DELTA.ADDED | 1 |
| Diff.DELTA.DELETED | 2 |
| Diff.DELTA.MODIFIED | 3 |
| Diff.DELTA.RENAMED | 4 |
| Diff.DELTA.COPIED | 5 |
| Diff.DELTA.IGNORED | 6 |
| Diff.DELTA.UNTRACKED | 7 |
| Diff.DELTA.TYPECHANGE | 8 |
| Diff.DELTA.UNREADABLE | 9 |
| Diff.DELTA.CONFLICTED | 10 |
| Flag | Value |
| --- | --- | --- |
| Diff.FIND.BY_CONFIG | 0 |
| Diff.FIND.RENAMES | 1 |
| Diff.FIND.RENAMES_FROM_REWRITES | 2 |
| Diff.FIND.COPIES | 4 |
| Diff.FIND.COPIES_FROM_UNMODIFIED | 8 |
| Diff.FIND.REWRITES | 16 |
| Diff.FIND.BREAK_REWRITES | 32 |
| Diff.FIND.AND_BREAK_REWRITES | 48 |
| Diff.FIND.FOR_UNTRACKED | 64 |
| Diff.FIND.ALL | 255 |
| Diff.FIND.IGNORE_LEADING_WHITESPACE | 0 |
| Diff.FIND.IGNORE_WHITESPACE | 4096 |
| Diff.FIND.DONT_IGNORE_WHITESPACE | 8192 |
| Diff.FIND.EXACT_MATCH_ONLY | 16384 |
| Diff.FIND.BREAK_REWRITES_FOR_RENAMES_ONLY | 32768 |
| Diff.FIND.REMOVE_UNMODIFIED | 65536 |
| Flag | Value |
| --- | --- | --- |
| Diff.FLAG.BINARY | 1 |
| Diff.FLAG.NOT_BINARY | 2 |
| Diff.FLAG.VALID_ID | 4 |
| Diff.FLAG.EXISTS | 8 |
| Flag | Value |
| --- | --- | --- |
| Diff.FORMAT.PATCH | 1 |
| Diff.FORMAT.PATCH_HEADER | 2 |
| Diff.FORMAT.RAW | 3 |
| Diff.FORMAT.NAME_ONLY | 4 |
| Diff.FORMAT.NAME_STATUS | 5 |
Diff.FORMAT_EMAIL_FLAGS ENUM
| Flag | Value |
| --- | --- | --- |
| Diff.FORMAT_EMAIL_FLAGS.FORMAT_EMAIL_NONE | 0 |
| Diff.FORMAT_EMAIL_FLAGS.FORMAT_EMAIL_EXCLUDE_SUBJECT_PATCH_MARKER | 1 |
| Flag | Value |
| --- | --- | --- |
| Diff.LINE.CONTEXT | 32 |
| Diff.LINE.ADDITION | 43 |
| Diff.LINE.DELETION | 45 |
| Diff.LINE.CONTEXT_EOFNL | 61 |
| Diff.LINE.ADD_EOFNL | 62 |
| Diff.LINE.DEL_EOFNL | 60 |
| Diff.LINE.FILE_HDR | 70 |
| Diff.LINE.HUNK_HDR | 72 |
| Diff.LINE.BINARY | 66 |
| Flag | Value |
| --- | --- | --- |
| Diff.OPTION.NORMAL | 0 |
| Diff.OPTION.REVERSE | 1 |
| Diff.OPTION.INCLUDE_IGNORED | 2 |
| Diff.OPTION.RECURSE_IGNORED_DIRS | 4 |
| Diff.OPTION.INCLUDE_UNTRACKED | 8 |
| Diff.OPTION.RECURSE_UNTRACKED_DIRS | 16 |
| Diff.OPTION.INCLUDE_UNMODIFIED | 32 |
| Diff.OPTION.INCLUDE_TYPECHANGE | 64 |
| Diff.OPTION.INCLUDE_TYPECHANGE_TREES | 128 |
| Diff.OPTION.IGNORE_FILEMODE | 256 |
| Diff.OPTION.IGNORE_SUBMODULES | 512 |
| Diff.OPTION.IGNORE_CASE | 1024 |
| Diff.OPTION.INCLUDE_CASECHANGE | 2048 |
| Diff.OPTION.DISABLE_PATHSPEC_MATCH | 4096 |
| Diff.OPTION.SKIP_BINARY_CHECK | 8192 |
| Diff.OPTION.ENABLE_FAST_UNTRACKED_DIRS | 16384 |
| Diff.OPTION.UPDATE_INDEX | 32768 |
| Diff.OPTION.INCLUDE_UNREADABLE | 65536 |
| Diff.OPTION.INCLUDE_UNREADABLE_AS_UNTRACKED | 131072 |
| Diff.OPTION.INDENT_HEURISTIC | 262144 |
| Diff.OPTION.FORCE_TEXT | 1048576 |
| Diff.OPTION.FORCE_BINARY | 2097152 |
| Diff.OPTION.IGNORE_WHITESPACE | 4194304 |
| Diff.OPTION.IGNORE_WHITESPACE_CHANGE | 8388608 |
| Diff.OPTION.IGNORE_WHITESPACE_EOL | 16777216 |
| Diff.OPTION.SHOW_UNTRACKED_CONTENT | 33554432 |
| Diff.OPTION.SHOW_UNMODIFIED | 67108864 |
| Diff.OPTION.PATIENCE | 268435456 |
| Diff.OPTION.MINIMAL | 536870912 |
| Diff.OPTION.SHOW_BINARY | 1073741824 |
| Flag | Value |
| --- | --- | --- |
| Diff.STATS_FORMAT.STATS_NONE | 0 |
| Diff.STATS_FORMAT.STATS_FULL | 1 |
| Diff.STATS_FORMAT.STATS_SHORT | 2 |
| Diff.STATS_FORMAT.STATS_NUMBER | 4 |
| Diff.STATS_FORMAT.STATS_INCLUDE_SUMMARY | 8 |