Patch.convenientFromDiff Async

Patch.convenientFromDiff(diff).then(function(stdVectorPatchdata) {
  // Use stdVectorPatchdata
});
Parameters Type  
diff Diff  
Returns  
Std::vector *  

Patch.fromBlobAndBuffer Async

Patch.fromBlobAndBuffer(old_blob, old_as_path, buffer, buffer_len, buffer_as_path, opts).then(function(patch) {
  // Use patch
});
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_len Number Length of raw data for new side of diff
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
Returns  
Patch The generated patch; NULL on error

Patch.fromBlobs Async

Patch.fromBlobs(old_blob, old_as_path, new_blob, new_as_path, opts).then(function(patch) {
  // Use patch
});
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
new_blob Blob Blob for new side of diff, or NULL for empty blob
new_as_path String Treat new blob as if it had this filename; can be NULL
opts DiffOptions Options for diff, or NULL for default options
Returns  
Patch The generated patch; NULL on error

Patch.fromDiff Async

Patch.fromDiff(diff, idx).then(function(patch) {
  // Use patch
});
Parameters Type  
diff Diff Diff list object
idx Number Index into diff list
Returns  
Patch Output parameter for the delta patch object

Patch#getDelta Sync

var diffDelta = patch.getDelta();
Returns  
DiffDelta  

Patch#getHunk Async

patch.getHunk(hunk_idx).then(function(result) {
  // Use result
});
Parameters Type  
hunk_idx Number Input index of hunk to get information about
Returns  
Number Output count of total lines in this hunk

Patch#getLineInHunk Async

patch.getLineInHunk(hunk_idx, line_of_hunk).then(function(diffLine) {
  // Use diffLine
});
Parameters Type  
hunk_idx Number The index of the hunk
line_of_hunk Number The index of the line in the hunk
Returns  
DiffLine The git_diff_line data for this line

Patch#lineStats Sync

var result = patch.lineStats();
Returns  
Number Count of deletion lines in output, can be NULL.

Patch#numHunks Sync

var result = patch.numHunks();
Returns  
Number  

Patch#numLinesInHunk Sync

var result = patch.numLinesInHunk(hunk_idx);
Parameters Type  
hunk_idx Number Index of the hunk
Returns  
Number Number of lines in hunk or GIT_ENOTFOUND if invalid hunk index

Patch#size Sync

var result = patch.size(include_context, include_hunk_headers, include_file_headers);
Parameters Type  
include_context Number Include context lines in size if non-zero
include_hunk_headers Number Include hunk header lines if non-zero
include_file_headers Number Include file header lines if non-zero
Returns  
Number The number of bytes of data