Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../opt/imh-pyth.../include/git2
File: diff.h
/*
[0] Fix | Delete
* Copyright (C) the libgit2 contributors. All rights reserved.
[1] Fix | Delete
*
[2] Fix | Delete
* This file is part of libgit2, distributed under the GNU GPL v2 with
[3] Fix | Delete
* a Linking Exception. For full terms see the included COPYING file.
[4] Fix | Delete
*/
[5] Fix | Delete
#ifndef INCLUDE_git_diff_h__
[6] Fix | Delete
#define INCLUDE_git_diff_h__
[7] Fix | Delete
[8] Fix | Delete
#include "common.h"
[9] Fix | Delete
#include "types.h"
[10] Fix | Delete
#include "oid.h"
[11] Fix | Delete
#include "tree.h"
[12] Fix | Delete
#include "refs.h"
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* @file git2/diff.h
[16] Fix | Delete
* @brief Git tree and file differencing routines.
[17] Fix | Delete
* @ingroup Git
[18] Fix | Delete
* @{
[19] Fix | Delete
*/
[20] Fix | Delete
GIT_BEGIN_DECL
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Flags for diff options. A combination of these flags can be passed
[24] Fix | Delete
* in via the `flags` value in the `git_diff_options`.
[25] Fix | Delete
*/
[26] Fix | Delete
typedef enum {
[27] Fix | Delete
/** Normal diff, the default */
[28] Fix | Delete
GIT_DIFF_NORMAL = 0,
[29] Fix | Delete
[30] Fix | Delete
/*
[31] Fix | Delete
* Options controlling which files will be in the diff
[32] Fix | Delete
*/
[33] Fix | Delete
[34] Fix | Delete
/** Reverse the sides of the diff */
[35] Fix | Delete
GIT_DIFF_REVERSE = (1u << 0),
[36] Fix | Delete
[37] Fix | Delete
/** Include ignored files in the diff */
[38] Fix | Delete
GIT_DIFF_INCLUDE_IGNORED = (1u << 1),
[39] Fix | Delete
[40] Fix | Delete
/** Even with GIT_DIFF_INCLUDE_IGNORED, an entire ignored directory
[41] Fix | Delete
* will be marked with only a single entry in the diff; this flag
[42] Fix | Delete
* adds all files under the directory as IGNORED entries, too.
[43] Fix | Delete
*/
[44] Fix | Delete
GIT_DIFF_RECURSE_IGNORED_DIRS = (1u << 2),
[45] Fix | Delete
[46] Fix | Delete
/** Include untracked files in the diff */
[47] Fix | Delete
GIT_DIFF_INCLUDE_UNTRACKED = (1u << 3),
[48] Fix | Delete
[49] Fix | Delete
/** Even with GIT_DIFF_INCLUDE_UNTRACKED, an entire untracked
[50] Fix | Delete
* directory will be marked with only a single entry in the diff
[51] Fix | Delete
* (a la what core Git does in `git status`); this flag adds *all*
[52] Fix | Delete
* files under untracked directories as UNTRACKED entries, too.
[53] Fix | Delete
*/
[54] Fix | Delete
GIT_DIFF_RECURSE_UNTRACKED_DIRS = (1u << 4),
[55] Fix | Delete
[56] Fix | Delete
/** Include unmodified files in the diff */
[57] Fix | Delete
GIT_DIFF_INCLUDE_UNMODIFIED = (1u << 5),
[58] Fix | Delete
[59] Fix | Delete
/** Normally, a type change between files will be converted into a
[60] Fix | Delete
* DELETED record for the old and an ADDED record for the new; this
[61] Fix | Delete
* options enabled the generation of TYPECHANGE delta records.
[62] Fix | Delete
*/
[63] Fix | Delete
GIT_DIFF_INCLUDE_TYPECHANGE = (1u << 6),
[64] Fix | Delete
[65] Fix | Delete
/** Even with GIT_DIFF_INCLUDE_TYPECHANGE, blob->tree changes still
[66] Fix | Delete
* generally show as a DELETED blob. This flag tries to correctly
[67] Fix | Delete
* label blob->tree transitions as TYPECHANGE records with new_file's
[68] Fix | Delete
* mode set to tree. Note: the tree SHA will not be available.
[69] Fix | Delete
*/
[70] Fix | Delete
GIT_DIFF_INCLUDE_TYPECHANGE_TREES = (1u << 7),
[71] Fix | Delete
[72] Fix | Delete
/** Ignore file mode changes */
[73] Fix | Delete
GIT_DIFF_IGNORE_FILEMODE = (1u << 8),
[74] Fix | Delete
[75] Fix | Delete
/** Treat all submodules as unmodified */
[76] Fix | Delete
GIT_DIFF_IGNORE_SUBMODULES = (1u << 9),
[77] Fix | Delete
[78] Fix | Delete
/** Use case insensitive filename comparisons */
[79] Fix | Delete
GIT_DIFF_IGNORE_CASE = (1u << 10),
[80] Fix | Delete
[81] Fix | Delete
/** May be combined with `GIT_DIFF_IGNORE_CASE` to specify that a file
[82] Fix | Delete
* that has changed case will be returned as an add/delete pair.
[83] Fix | Delete
*/
[84] Fix | Delete
GIT_DIFF_INCLUDE_CASECHANGE = (1u << 11),
[85] Fix | Delete
[86] Fix | Delete
/** If the pathspec is set in the diff options, this flags indicates
[87] Fix | Delete
* that the paths will be treated as literal paths instead of
[88] Fix | Delete
* fnmatch patterns. Each path in the list must either be a full
[89] Fix | Delete
* path to a file or a directory. (A trailing slash indicates that
[90] Fix | Delete
* the path will _only_ match a directory). If a directory is
[91] Fix | Delete
* specified, all children will be included.
[92] Fix | Delete
*/
[93] Fix | Delete
GIT_DIFF_DISABLE_PATHSPEC_MATCH = (1u << 12),
[94] Fix | Delete
[95] Fix | Delete
/** Disable updating of the `binary` flag in delta records. This is
[96] Fix | Delete
* useful when iterating over a diff if you don't need hunk and data
[97] Fix | Delete
* callbacks and want to avoid having to load file completely.
[98] Fix | Delete
*/
[99] Fix | Delete
GIT_DIFF_SKIP_BINARY_CHECK = (1u << 13),
[100] Fix | Delete
[101] Fix | Delete
/** When diff finds an untracked directory, to match the behavior of
[102] Fix | Delete
* core Git, it scans the contents for IGNORED and UNTRACKED files.
[103] Fix | Delete
* If *all* contents are IGNORED, then the directory is IGNORED; if
[104] Fix | Delete
* any contents are not IGNORED, then the directory is UNTRACKED.
[105] Fix | Delete
* This is extra work that may not matter in many cases. This flag
[106] Fix | Delete
* turns off that scan and immediately labels an untracked directory
[107] Fix | Delete
* as UNTRACKED (changing the behavior to not match core Git).
[108] Fix | Delete
*/
[109] Fix | Delete
GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS = (1u << 14),
[110] Fix | Delete
[111] Fix | Delete
/** When diff finds a file in the working directory with stat
[112] Fix | Delete
* information different from the index, but the OID ends up being the
[113] Fix | Delete
* same, write the correct stat information into the index. Note:
[114] Fix | Delete
* without this flag, diff will always leave the index untouched.
[115] Fix | Delete
*/
[116] Fix | Delete
GIT_DIFF_UPDATE_INDEX = (1u << 15),
[117] Fix | Delete
[118] Fix | Delete
/** Include unreadable files in the diff */
[119] Fix | Delete
GIT_DIFF_INCLUDE_UNREADABLE = (1u << 16),
[120] Fix | Delete
[121] Fix | Delete
/** Include unreadable files in the diff */
[122] Fix | Delete
GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKED = (1u << 17),
[123] Fix | Delete
[124] Fix | Delete
/*
[125] Fix | Delete
* Options controlling how output will be generated
[126] Fix | Delete
*/
[127] Fix | Delete
[128] Fix | Delete
/** Use a heuristic that takes indentation and whitespace into account
[129] Fix | Delete
* which generally can produce better diffs when dealing with ambiguous
[130] Fix | Delete
* diff hunks.
[131] Fix | Delete
*/
[132] Fix | Delete
GIT_DIFF_INDENT_HEURISTIC = (1u << 18),
[133] Fix | Delete
[134] Fix | Delete
/** Treat all files as text, disabling binary attributes & detection */
[135] Fix | Delete
GIT_DIFF_FORCE_TEXT = (1u << 20),
[136] Fix | Delete
/** Treat all files as binary, disabling text diffs */
[137] Fix | Delete
GIT_DIFF_FORCE_BINARY = (1u << 21),
[138] Fix | Delete
[139] Fix | Delete
/** Ignore all whitespace */
[140] Fix | Delete
GIT_DIFF_IGNORE_WHITESPACE = (1u << 22),
[141] Fix | Delete
/** Ignore changes in amount of whitespace */
[142] Fix | Delete
GIT_DIFF_IGNORE_WHITESPACE_CHANGE = (1u << 23),
[143] Fix | Delete
/** Ignore whitespace at end of line */
[144] Fix | Delete
GIT_DIFF_IGNORE_WHITESPACE_EOL = (1u << 24),
[145] Fix | Delete
[146] Fix | Delete
/** When generating patch text, include the content of untracked
[147] Fix | Delete
* files. This automatically turns on GIT_DIFF_INCLUDE_UNTRACKED but
[148] Fix | Delete
* it does not turn on GIT_DIFF_RECURSE_UNTRACKED_DIRS. Add that
[149] Fix | Delete
* flag if you want the content of every single UNTRACKED file.
[150] Fix | Delete
*/
[151] Fix | Delete
GIT_DIFF_SHOW_UNTRACKED_CONTENT = (1u << 25),
[152] Fix | Delete
[153] Fix | Delete
/** When generating output, include the names of unmodified files if
[154] Fix | Delete
* they are included in the git_diff. Normally these are skipped in
[155] Fix | Delete
* the formats that list files (e.g. name-only, name-status, raw).
[156] Fix | Delete
* Even with this, these will not be included in patch format.
[157] Fix | Delete
*/
[158] Fix | Delete
GIT_DIFF_SHOW_UNMODIFIED = (1u << 26),
[159] Fix | Delete
[160] Fix | Delete
/** Use the "patience diff" algorithm */
[161] Fix | Delete
GIT_DIFF_PATIENCE = (1u << 28),
[162] Fix | Delete
/** Take extra time to find minimal diff */
[163] Fix | Delete
GIT_DIFF_MINIMAL = (1u << 29),
[164] Fix | Delete
[165] Fix | Delete
/** Include the necessary deflate / delta information so that `git-apply`
[166] Fix | Delete
* can apply given diff information to binary files.
[167] Fix | Delete
*/
[168] Fix | Delete
GIT_DIFF_SHOW_BINARY = (1u << 30),
[169] Fix | Delete
} git_diff_option_t;
[170] Fix | Delete
[171] Fix | Delete
/**
[172] Fix | Delete
* The diff object that contains all individual file deltas.
[173] Fix | Delete
*
[174] Fix | Delete
* A `diff` represents the cumulative list of differences between two
[175] Fix | Delete
* snapshots of a repository (possibly filtered by a set of file name
[176] Fix | Delete
* patterns).
[177] Fix | Delete
*
[178] Fix | Delete
* Calculating diffs is generally done in two phases: building a list of
[179] Fix | Delete
* diffs then traversing it. This makes is easier to share logic across
[180] Fix | Delete
* the various types of diffs (tree vs tree, workdir vs index, etc.), and
[181] Fix | Delete
* also allows you to insert optional diff post-processing phases,
[182] Fix | Delete
* such as rename detection, in between the steps. When you are done with
[183] Fix | Delete
* a diff object, it must be freed.
[184] Fix | Delete
*
[185] Fix | Delete
* This is an opaque structure which will be allocated by one of the diff
[186] Fix | Delete
* generator functions below (such as `git_diff_tree_to_tree`). You are
[187] Fix | Delete
* responsible for releasing the object memory when done, using the
[188] Fix | Delete
* `git_diff_free()` function.
[189] Fix | Delete
*
[190] Fix | Delete
*/
[191] Fix | Delete
typedef struct git_diff git_diff;
[192] Fix | Delete
[193] Fix | Delete
/**
[194] Fix | Delete
* Flags for the delta object and the file objects on each side.
[195] Fix | Delete
*
[196] Fix | Delete
* These flags are used for both the `flags` value of the `git_diff_delta`
[197] Fix | Delete
* and the flags for the `git_diff_file` objects representing the old and
[198] Fix | Delete
* new sides of the delta. Values outside of this public range should be
[199] Fix | Delete
* considered reserved for internal or future use.
[200] Fix | Delete
*/
[201] Fix | Delete
typedef enum {
[202] Fix | Delete
GIT_DIFF_FLAG_BINARY = (1u << 0), /**< file(s) treated as binary data */
[203] Fix | Delete
GIT_DIFF_FLAG_NOT_BINARY = (1u << 1), /**< file(s) treated as text data */
[204] Fix | Delete
GIT_DIFF_FLAG_VALID_ID = (1u << 2), /**< `id` value is known correct */
[205] Fix | Delete
GIT_DIFF_FLAG_EXISTS = (1u << 3), /**< file exists at this side of the delta */
[206] Fix | Delete
} git_diff_flag_t;
[207] Fix | Delete
[208] Fix | Delete
/**
[209] Fix | Delete
* What type of change is described by a git_diff_delta?
[210] Fix | Delete
*
[211] Fix | Delete
* `GIT_DELTA_RENAMED` and `GIT_DELTA_COPIED` will only show up if you run
[212] Fix | Delete
* `git_diff_find_similar()` on the diff object.
[213] Fix | Delete
*
[214] Fix | Delete
* `GIT_DELTA_TYPECHANGE` only shows up given `GIT_DIFF_INCLUDE_TYPECHANGE`
[215] Fix | Delete
* in the option flags (otherwise type changes will be split into ADDED /
[216] Fix | Delete
* DELETED pairs).
[217] Fix | Delete
*/
[218] Fix | Delete
typedef enum {
[219] Fix | Delete
GIT_DELTA_UNMODIFIED = 0, /**< no changes */
[220] Fix | Delete
GIT_DELTA_ADDED = 1, /**< entry does not exist in old version */
[221] Fix | Delete
GIT_DELTA_DELETED = 2, /**< entry does not exist in new version */
[222] Fix | Delete
GIT_DELTA_MODIFIED = 3, /**< entry content changed between old and new */
[223] Fix | Delete
GIT_DELTA_RENAMED = 4, /**< entry was renamed between old and new */
[224] Fix | Delete
GIT_DELTA_COPIED = 5, /**< entry was copied from another old entry */
[225] Fix | Delete
GIT_DELTA_IGNORED = 6, /**< entry is ignored item in workdir */
[226] Fix | Delete
GIT_DELTA_UNTRACKED = 7, /**< entry is untracked item in workdir */
[227] Fix | Delete
GIT_DELTA_TYPECHANGE = 8, /**< type of entry changed between old and new */
[228] Fix | Delete
GIT_DELTA_UNREADABLE = 9, /**< entry is unreadable */
[229] Fix | Delete
GIT_DELTA_CONFLICTED = 10, /**< entry in the index is conflicted */
[230] Fix | Delete
} git_delta_t;
[231] Fix | Delete
[232] Fix | Delete
/**
[233] Fix | Delete
* Description of one side of a delta.
[234] Fix | Delete
*
[235] Fix | Delete
* Although this is called a "file", it could represent a file, a symbolic
[236] Fix | Delete
* link, a submodule commit id, or even a tree (although that only if you
[237] Fix | Delete
* are tracking type changes or ignored/untracked directories).
[238] Fix | Delete
*
[239] Fix | Delete
* The `id` is the `git_oid` of the item. If the entry represents an
[240] Fix | Delete
* absent side of a diff (e.g. the `old_file` of a `GIT_DELTA_ADDED` delta),
[241] Fix | Delete
* then the oid will be zeroes.
[242] Fix | Delete
*
[243] Fix | Delete
* `path` is the NUL-terminated path to the entry relative to the working
[244] Fix | Delete
* directory of the repository.
[245] Fix | Delete
*
[246] Fix | Delete
* `size` is the size of the entry in bytes.
[247] Fix | Delete
*
[248] Fix | Delete
* `flags` is a combination of the `git_diff_flag_t` types
[249] Fix | Delete
*
[250] Fix | Delete
* `mode` is, roughly, the stat() `st_mode` value for the item. This will
[251] Fix | Delete
* be restricted to one of the `git_filemode_t` values.
[252] Fix | Delete
*
[253] Fix | Delete
* The `id_abbrev` represents the known length of the `id` field, when
[254] Fix | Delete
* converted to a hex string. It is generally `GIT_OID_HEXSZ`, unless this
[255] Fix | Delete
* delta was created from reading a patch file, in which case it may be
[256] Fix | Delete
* abbreviated to something reasonable, like 7 characters.
[257] Fix | Delete
*/
[258] Fix | Delete
typedef struct {
[259] Fix | Delete
git_oid id;
[260] Fix | Delete
const char *path;
[261] Fix | Delete
git_object_size_t size;
[262] Fix | Delete
uint32_t flags;
[263] Fix | Delete
uint16_t mode;
[264] Fix | Delete
uint16_t id_abbrev;
[265] Fix | Delete
} git_diff_file;
[266] Fix | Delete
[267] Fix | Delete
/**
[268] Fix | Delete
* Description of changes to one entry.
[269] Fix | Delete
*
[270] Fix | Delete
* A `delta` is a file pair with an old and new revision. The old version
[271] Fix | Delete
* may be absent if the file was just created and the new version may be
[272] Fix | Delete
* absent if the file was deleted. A diff is mostly just a list of deltas.
[273] Fix | Delete
*
[274] Fix | Delete
* When iterating over a diff, this will be passed to most callbacks and
[275] Fix | Delete
* you can use the contents to understand exactly what has changed.
[276] Fix | Delete
*
[277] Fix | Delete
* The `old_file` represents the "from" side of the diff and the `new_file`
[278] Fix | Delete
* represents to "to" side of the diff. What those means depend on the
[279] Fix | Delete
* function that was used to generate the diff and will be documented below.
[280] Fix | Delete
* You can also use the `GIT_DIFF_REVERSE` flag to flip it around.
[281] Fix | Delete
*
[282] Fix | Delete
* Although the two sides of the delta are named "old_file" and "new_file",
[283] Fix | Delete
* they actually may correspond to entries that represent a file, a symbolic
[284] Fix | Delete
* link, a submodule commit id, or even a tree (if you are tracking type
[285] Fix | Delete
* changes or ignored/untracked directories).
[286] Fix | Delete
*
[287] Fix | Delete
* Under some circumstances, in the name of efficiency, not all fields will
[288] Fix | Delete
* be filled in, but we generally try to fill in as much as possible. One
[289] Fix | Delete
* example is that the "flags" field may not have either the `BINARY` or the
[290] Fix | Delete
* `NOT_BINARY` flag set to avoid examining file contents if you do not pass
[291] Fix | Delete
* in hunk and/or line callbacks to the diff foreach iteration function. It
[292] Fix | Delete
* will just use the git attributes for those files.
[293] Fix | Delete
*
[294] Fix | Delete
* The similarity score is zero unless you call `git_diff_find_similar()`
[295] Fix | Delete
* which does a similarity analysis of files in the diff. Use that
[296] Fix | Delete
* function to do rename and copy detection, and to split heavily modified
[297] Fix | Delete
* files in add/delete pairs. After that call, deltas with a status of
[298] Fix | Delete
* GIT_DELTA_RENAMED or GIT_DELTA_COPIED will have a similarity score
[299] Fix | Delete
* between 0 and 100 indicating how similar the old and new sides are.
[300] Fix | Delete
*
[301] Fix | Delete
* If you ask `git_diff_find_similar` to find heavily modified files to
[302] Fix | Delete
* break, but to not *actually* break the records, then GIT_DELTA_MODIFIED
[303] Fix | Delete
* records may have a non-zero similarity score if the self-similarity is
[304] Fix | Delete
* below the split threshold. To display this value like core Git, invert
[305] Fix | Delete
* the score (a la `printf("M%03d", 100 - delta->similarity)`).
[306] Fix | Delete
*/
[307] Fix | Delete
typedef struct {
[308] Fix | Delete
git_delta_t status;
[309] Fix | Delete
uint32_t flags; /**< git_diff_flag_t values */
[310] Fix | Delete
uint16_t similarity; /**< for RENAMED and COPIED, value 0-100 */
[311] Fix | Delete
uint16_t nfiles; /**< number of files in this delta */
[312] Fix | Delete
git_diff_file old_file;
[313] Fix | Delete
git_diff_file new_file;
[314] Fix | Delete
} git_diff_delta;
[315] Fix | Delete
[316] Fix | Delete
/**
[317] Fix | Delete
* Diff notification callback function.
[318] Fix | Delete
*
[319] Fix | Delete
* The callback will be called for each file, just before the `git_diff_delta`
[320] Fix | Delete
* gets inserted into the diff.
[321] Fix | Delete
*
[322] Fix | Delete
* When the callback:
[323] Fix | Delete
* - returns < 0, the diff process will be aborted.
[324] Fix | Delete
* - returns > 0, the delta will not be inserted into the diff, but the
[325] Fix | Delete
* diff process continues.
[326] Fix | Delete
* - returns 0, the delta is inserted into the diff, and the diff process
[327] Fix | Delete
* continues.
[328] Fix | Delete
*/
[329] Fix | Delete
typedef int GIT_CALLBACK(git_diff_notify_cb)(
[330] Fix | Delete
const git_diff *diff_so_far,
[331] Fix | Delete
const git_diff_delta *delta_to_add,
[332] Fix | Delete
const char *matched_pathspec,
[333] Fix | Delete
void *payload);
[334] Fix | Delete
[335] Fix | Delete
/**
[336] Fix | Delete
* Diff progress callback.
[337] Fix | Delete
*
[338] Fix | Delete
* Called before each file comparison.
[339] Fix | Delete
*
[340] Fix | Delete
* @param diff_so_far The diff being generated.
[341] Fix | Delete
* @param old_path The path to the old file or NULL.
[342] Fix | Delete
* @param new_path The path to the new file or NULL.
[343] Fix | Delete
* @return Non-zero to abort the diff.
[344] Fix | Delete
*/
[345] Fix | Delete
typedef int GIT_CALLBACK(git_diff_progress_cb)(
[346] Fix | Delete
const git_diff *diff_so_far,
[347] Fix | Delete
const char *old_path,
[348] Fix | Delete
const char *new_path,
[349] Fix | Delete
void *payload);
[350] Fix | Delete
[351] Fix | Delete
/**
[352] Fix | Delete
* Structure describing options about how the diff should be executed.
[353] Fix | Delete
*
[354] Fix | Delete
* Setting all values of the structure to zero will yield the default
[355] Fix | Delete
* values. Similarly, passing NULL for the options structure will
[356] Fix | Delete
* give the defaults. The default values are marked below.
[357] Fix | Delete
*
[358] Fix | Delete
*/
[359] Fix | Delete
typedef struct {
[360] Fix | Delete
unsigned int version; /**< version for the struct */
[361] Fix | Delete
[362] Fix | Delete
/**
[363] Fix | Delete
* A combination of `git_diff_option_t` values above.
[364] Fix | Delete
* Defaults to GIT_DIFF_NORMAL
[365] Fix | Delete
*/
[366] Fix | Delete
uint32_t flags;
[367] Fix | Delete
[368] Fix | Delete
/* options controlling which files are in the diff */
[369] Fix | Delete
[370] Fix | Delete
/** Overrides the submodule ignore setting for all submodules in the diff. */
[371] Fix | Delete
git_submodule_ignore_t ignore_submodules;
[372] Fix | Delete
[373] Fix | Delete
/**
[374] Fix | Delete
* An array of paths / fnmatch patterns to constrain diff.
[375] Fix | Delete
* All paths are included by default.
[376] Fix | Delete
*/
[377] Fix | Delete
git_strarray pathspec;
[378] Fix | Delete
[379] Fix | Delete
/**
[380] Fix | Delete
* An optional callback function, notifying the consumer of changes to
[381] Fix | Delete
* the diff as new deltas are added.
[382] Fix | Delete
*/
[383] Fix | Delete
git_diff_notify_cb notify_cb;
[384] Fix | Delete
[385] Fix | Delete
/**
[386] Fix | Delete
* An optional callback function, notifying the consumer of which files
[387] Fix | Delete
* are being examined as the diff is generated.
[388] Fix | Delete
*/
[389] Fix | Delete
git_diff_progress_cb progress_cb;
[390] Fix | Delete
[391] Fix | Delete
/** The payload to pass to the callback functions. */
[392] Fix | Delete
void *payload;
[393] Fix | Delete
[394] Fix | Delete
/* options controlling how to diff text is generated */
[395] Fix | Delete
[396] Fix | Delete
/**
[397] Fix | Delete
* The number of unchanged lines that define the boundary of a hunk
[398] Fix | Delete
* (and to display before and after). Defaults to 3.
[399] Fix | Delete
*/
[400] Fix | Delete
uint32_t context_lines;
[401] Fix | Delete
/**
[402] Fix | Delete
* The maximum number of unchanged lines between hunk boundaries before
[403] Fix | Delete
* the hunks will be merged into one. Defaults to 0.
[404] Fix | Delete
*/
[405] Fix | Delete
uint32_t interhunk_lines;
[406] Fix | Delete
[407] Fix | Delete
/**
[408] Fix | Delete
* The abbreviation length to use when formatting object ids.
[409] Fix | Delete
* Defaults to the value of 'core.abbrev' from the config, or 7 if unset.
[410] Fix | Delete
*/
[411] Fix | Delete
uint16_t id_abbrev;
[412] Fix | Delete
[413] Fix | Delete
/**
[414] Fix | Delete
* A size (in bytes) above which a blob will be marked as binary
[415] Fix | Delete
* automatically; pass a negative value to disable.
[416] Fix | Delete
* Defaults to 512MB.
[417] Fix | Delete
*/
[418] Fix | Delete
git_off_t max_size;
[419] Fix | Delete
[420] Fix | Delete
/**
[421] Fix | Delete
* The virtual "directory" prefix for old file names in hunk headers.
[422] Fix | Delete
* Default is "a".
[423] Fix | Delete
*/
[424] Fix | Delete
const char *old_prefix;
[425] Fix | Delete
[426] Fix | Delete
/**
[427] Fix | Delete
* The virtual "directory" prefix for new file names in hunk headers.
[428] Fix | Delete
* Defaults to "b".
[429] Fix | Delete
*/
[430] Fix | Delete
const char *new_prefix;
[431] Fix | Delete
} git_diff_options;
[432] Fix | Delete
[433] Fix | Delete
/* The current version of the diff options structure */
[434] Fix | Delete
#define GIT_DIFF_OPTIONS_VERSION 1
[435] Fix | Delete
[436] Fix | Delete
/* Stack initializer for diff options. Alternatively use
[437] Fix | Delete
* `git_diff_options_init` programmatic initialization.
[438] Fix | Delete
*/
[439] Fix | Delete
#define GIT_DIFF_OPTIONS_INIT \
[440] Fix | Delete
{GIT_DIFF_OPTIONS_VERSION, 0, GIT_SUBMODULE_IGNORE_UNSPECIFIED, {NULL,0}, NULL, NULL, NULL, 3}
[441] Fix | Delete
[442] Fix | Delete
/**
[443] Fix | Delete
* Initialize git_diff_options structure
[444] Fix | Delete
*
[445] Fix | Delete
* Initializes a `git_diff_options` with default values. Equivalent to creating
[446] Fix | Delete
* an instance with GIT_DIFF_OPTIONS_INIT.
[447] Fix | Delete
*
[448] Fix | Delete
* @param opts The `git_diff_options` struct to initialize.
[449] Fix | Delete
* @param version The struct version; pass `GIT_DIFF_OPTIONS_VERSION`.
[450] Fix | Delete
* @return Zero on success; -1 on failure.
[451] Fix | Delete
*/
[452] Fix | Delete
GIT_EXTERN(int) git_diff_options_init(
[453] Fix | Delete
git_diff_options *opts,
[454] Fix | Delete
unsigned int version);
[455] Fix | Delete
[456] Fix | Delete
/**
[457] Fix | Delete
* When iterating over a diff, callback that will be made per file.
[458] Fix | Delete
*
[459] Fix | Delete
* @param delta A pointer to the delta data for the file
[460] Fix | Delete
* @param progress Goes from 0 to 1 over the diff
[461] Fix | Delete
* @param payload User-specified pointer from foreach function
[462] Fix | Delete
*/
[463] Fix | Delete
typedef int GIT_CALLBACK(git_diff_file_cb)(
[464] Fix | Delete
const git_diff_delta *delta,
[465] Fix | Delete
float progress,
[466] Fix | Delete
void *payload);
[467] Fix | Delete
[468] Fix | Delete
#define GIT_DIFF_HUNK_HEADER_SIZE 128
[469] Fix | Delete
[470] Fix | Delete
/**
[471] Fix | Delete
* When producing a binary diff, the binary data returned will be
[472] Fix | Delete
* either the deflated full ("literal") contents of the file, or
[473] Fix | Delete
* the deflated binary delta between the two sides (whichever is
[474] Fix | Delete
* smaller).
[475] Fix | Delete
*/
[476] Fix | Delete
typedef enum {
[477] Fix | Delete
/** There is no binary delta. */
[478] Fix | Delete
GIT_DIFF_BINARY_NONE,
[479] Fix | Delete
[480] Fix | Delete
/** The binary data is the literal contents of the file. */
[481] Fix | Delete
GIT_DIFF_BINARY_LITERAL,
[482] Fix | Delete
[483] Fix | Delete
/** The binary data is the delta from one side to the other. */
[484] Fix | Delete
GIT_DIFF_BINARY_DELTA,
[485] Fix | Delete
} git_diff_binary_t;
[486] Fix | Delete
[487] Fix | Delete
/** The contents of one of the files in a binary diff. */
[488] Fix | Delete
typedef struct {
[489] Fix | Delete
/** The type of binary data for this file. */
[490] Fix | Delete
git_diff_binary_t type;
[491] Fix | Delete
[492] Fix | Delete
/** The binary data, deflated. */
[493] Fix | Delete
const char *data;
[494] Fix | Delete
[495] Fix | Delete
/** The length of the binary data. */
[496] Fix | Delete
size_t datalen;
[497] Fix | Delete
[498] Fix | Delete
/** The length of the binary data after inflation. */
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function