Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../opt/imh-pyth.../include/git2
File: index.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_index_h__
[6] Fix | Delete
#define INCLUDE_git_index_h__
[7] Fix | Delete
[8] Fix | Delete
#include "common.h"
[9] Fix | Delete
#include "indexer.h"
[10] Fix | Delete
#include "types.h"
[11] Fix | Delete
#include "oid.h"
[12] Fix | Delete
#include "strarray.h"
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* @file git2/index.h
[16] Fix | Delete
* @brief Git index parsing and manipulation routines
[17] Fix | Delete
* @defgroup git_index Git index parsing and manipulation routines
[18] Fix | Delete
* @ingroup Git
[19] Fix | Delete
* @{
[20] Fix | Delete
*/
[21] Fix | Delete
GIT_BEGIN_DECL
[22] Fix | Delete
[23] Fix | Delete
/** Time structure used in a git index entry */
[24] Fix | Delete
typedef struct {
[25] Fix | Delete
int32_t seconds;
[26] Fix | Delete
/* nsec should not be stored as time_t compatible */
[27] Fix | Delete
uint32_t nanoseconds;
[28] Fix | Delete
} git_index_time;
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* In-memory representation of a file entry in the index.
[32] Fix | Delete
*
[33] Fix | Delete
* This is a public structure that represents a file entry in the index.
[34] Fix | Delete
* The meaning of the fields corresponds to core Git's documentation (in
[35] Fix | Delete
* "Documentation/technical/index-format.txt").
[36] Fix | Delete
*
[37] Fix | Delete
* The `flags` field consists of a number of bit fields which can be
[38] Fix | Delete
* accessed via the first set of `GIT_INDEX_ENTRY_...` bitmasks below.
[39] Fix | Delete
* These flags are all read from and persisted to disk.
[40] Fix | Delete
*
[41] Fix | Delete
* The `flags_extended` field also has a number of bit fields which can be
[42] Fix | Delete
* accessed via the later `GIT_INDEX_ENTRY_...` bitmasks below. Some of
[43] Fix | Delete
* these flags are read from and written to disk, but some are set aside
[44] Fix | Delete
* for in-memory only reference.
[45] Fix | Delete
*
[46] Fix | Delete
* Note that the time and size fields are truncated to 32 bits. This
[47] Fix | Delete
* is enough to detect changes, which is enough for the index to
[48] Fix | Delete
* function as a cache, but it should not be taken as an authoritative
[49] Fix | Delete
* source for that data.
[50] Fix | Delete
*/
[51] Fix | Delete
typedef struct git_index_entry {
[52] Fix | Delete
git_index_time ctime;
[53] Fix | Delete
git_index_time mtime;
[54] Fix | Delete
[55] Fix | Delete
uint32_t dev;
[56] Fix | Delete
uint32_t ino;
[57] Fix | Delete
uint32_t mode;
[58] Fix | Delete
uint32_t uid;
[59] Fix | Delete
uint32_t gid;
[60] Fix | Delete
uint32_t file_size;
[61] Fix | Delete
[62] Fix | Delete
git_oid id;
[63] Fix | Delete
[64] Fix | Delete
uint16_t flags;
[65] Fix | Delete
uint16_t flags_extended;
[66] Fix | Delete
[67] Fix | Delete
const char *path;
[68] Fix | Delete
} git_index_entry;
[69] Fix | Delete
[70] Fix | Delete
/**
[71] Fix | Delete
* Bitmasks for on-disk fields of `git_index_entry`'s `flags`
[72] Fix | Delete
*
[73] Fix | Delete
* These bitmasks match the four fields in the `git_index_entry` `flags`
[74] Fix | Delete
* value both in memory and on disk. You can use them to interpret the
[75] Fix | Delete
* data in the `flags`.
[76] Fix | Delete
*/
[77] Fix | Delete
[78] Fix | Delete
#define GIT_INDEX_ENTRY_NAMEMASK (0x0fff)
[79] Fix | Delete
#define GIT_INDEX_ENTRY_STAGEMASK (0x3000)
[80] Fix | Delete
#define GIT_INDEX_ENTRY_STAGESHIFT 12
[81] Fix | Delete
[82] Fix | Delete
/**
[83] Fix | Delete
* Flags for index entries
[84] Fix | Delete
*/
[85] Fix | Delete
typedef enum {
[86] Fix | Delete
GIT_INDEX_ENTRY_EXTENDED = (0x4000),
[87] Fix | Delete
GIT_INDEX_ENTRY_VALID = (0x8000),
[88] Fix | Delete
} git_index_entry_flag_t;
[89] Fix | Delete
[90] Fix | Delete
#define GIT_INDEX_ENTRY_STAGE(E) \
[91] Fix | Delete
(((E)->flags & GIT_INDEX_ENTRY_STAGEMASK) >> GIT_INDEX_ENTRY_STAGESHIFT)
[92] Fix | Delete
[93] Fix | Delete
#define GIT_INDEX_ENTRY_STAGE_SET(E,S) do { \
[94] Fix | Delete
(E)->flags = ((E)->flags & ~GIT_INDEX_ENTRY_STAGEMASK) | \
[95] Fix | Delete
(((S) & 0x03) << GIT_INDEX_ENTRY_STAGESHIFT); } while (0)
[96] Fix | Delete
[97] Fix | Delete
/**
[98] Fix | Delete
* Bitmasks for on-disk fields of `git_index_entry`'s `flags_extended`
[99] Fix | Delete
*
[100] Fix | Delete
* In memory, the `flags_extended` fields are divided into two parts: the
[101] Fix | Delete
* fields that are read from and written to disk, and other fields that
[102] Fix | Delete
* in-memory only and used by libgit2. Only the flags in
[103] Fix | Delete
* `GIT_INDEX_ENTRY_EXTENDED_FLAGS` will get saved on-disk.
[104] Fix | Delete
*
[105] Fix | Delete
* Thee first three bitmasks match the three fields in the
[106] Fix | Delete
* `git_index_entry` `flags_extended` value that belong on disk. You
[107] Fix | Delete
* can use them to interpret the data in the `flags_extended`.
[108] Fix | Delete
*
[109] Fix | Delete
* The rest of the bitmasks match the other fields in the `git_index_entry`
[110] Fix | Delete
* `flags_extended` value that are only used in-memory by libgit2.
[111] Fix | Delete
* You can use them to interpret the data in the `flags_extended`.
[112] Fix | Delete
*
[113] Fix | Delete
*/
[114] Fix | Delete
typedef enum {
[115] Fix | Delete
GIT_INDEX_ENTRY_INTENT_TO_ADD = (1 << 13),
[116] Fix | Delete
GIT_INDEX_ENTRY_SKIP_WORKTREE = (1 << 14),
[117] Fix | Delete
[118] Fix | Delete
GIT_INDEX_ENTRY_EXTENDED_FLAGS = (GIT_INDEX_ENTRY_INTENT_TO_ADD | GIT_INDEX_ENTRY_SKIP_WORKTREE),
[119] Fix | Delete
[120] Fix | Delete
GIT_INDEX_ENTRY_UPTODATE = (1 << 2),
[121] Fix | Delete
} git_index_entry_extended_flag_t;
[122] Fix | Delete
[123] Fix | Delete
/** Capabilities of system that affect index actions. */
[124] Fix | Delete
typedef enum {
[125] Fix | Delete
GIT_INDEX_CAPABILITY_IGNORE_CASE = 1,
[126] Fix | Delete
GIT_INDEX_CAPABILITY_NO_FILEMODE = 2,
[127] Fix | Delete
GIT_INDEX_CAPABILITY_NO_SYMLINKS = 4,
[128] Fix | Delete
GIT_INDEX_CAPABILITY_FROM_OWNER = -1,
[129] Fix | Delete
} git_index_capability_t;
[130] Fix | Delete
[131] Fix | Delete
[132] Fix | Delete
/** Callback for APIs that add/remove/update files matching pathspec */
[133] Fix | Delete
typedef int GIT_CALLBACK(git_index_matched_path_cb)(
[134] Fix | Delete
const char *path, const char *matched_pathspec, void *payload);
[135] Fix | Delete
[136] Fix | Delete
/** Flags for APIs that add files matching pathspec */
[137] Fix | Delete
typedef enum {
[138] Fix | Delete
GIT_INDEX_ADD_DEFAULT = 0,
[139] Fix | Delete
GIT_INDEX_ADD_FORCE = (1u << 0),
[140] Fix | Delete
GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH = (1u << 1),
[141] Fix | Delete
GIT_INDEX_ADD_CHECK_PATHSPEC = (1u << 2),
[142] Fix | Delete
} git_index_add_option_t;
[143] Fix | Delete
[144] Fix | Delete
/** Git index stage states */
[145] Fix | Delete
typedef enum {
[146] Fix | Delete
/**
[147] Fix | Delete
* Match any index stage.
[148] Fix | Delete
*
[149] Fix | Delete
* Some index APIs take a stage to match; pass this value to match
[150] Fix | Delete
* any entry matching the path regardless of stage.
[151] Fix | Delete
*/
[152] Fix | Delete
GIT_INDEX_STAGE_ANY = -1,
[153] Fix | Delete
[154] Fix | Delete
/** A normal staged file in the index. */
[155] Fix | Delete
GIT_INDEX_STAGE_NORMAL = 0,
[156] Fix | Delete
[157] Fix | Delete
/** The ancestor side of a conflict. */
[158] Fix | Delete
GIT_INDEX_STAGE_ANCESTOR = 1,
[159] Fix | Delete
[160] Fix | Delete
/** The "ours" side of a conflict. */
[161] Fix | Delete
GIT_INDEX_STAGE_OURS = 2,
[162] Fix | Delete
[163] Fix | Delete
/** The "theirs" side of a conflict. */
[164] Fix | Delete
GIT_INDEX_STAGE_THEIRS = 3,
[165] Fix | Delete
} git_index_stage_t;
[166] Fix | Delete
[167] Fix | Delete
/**
[168] Fix | Delete
* Create a new bare Git index object as a memory representation
[169] Fix | Delete
* of the Git index file in 'index_path', without a repository
[170] Fix | Delete
* to back it.
[171] Fix | Delete
*
[172] Fix | Delete
* Since there is no ODB or working directory behind this index,
[173] Fix | Delete
* any Index methods which rely on these (e.g. index_add_bypath)
[174] Fix | Delete
* will fail with the GIT_ERROR error code.
[175] Fix | Delete
*
[176] Fix | Delete
* If you need to access the index of an actual repository,
[177] Fix | Delete
* use the `git_repository_index` wrapper.
[178] Fix | Delete
*
[179] Fix | Delete
* The index must be freed once it's no longer in use.
[180] Fix | Delete
*
[181] Fix | Delete
* @param out the pointer for the new index
[182] Fix | Delete
* @param index_path the path to the index file in disk
[183] Fix | Delete
* @return 0 or an error code
[184] Fix | Delete
*/
[185] Fix | Delete
GIT_EXTERN(int) git_index_open(git_index **out, const char *index_path);
[186] Fix | Delete
[187] Fix | Delete
/**
[188] Fix | Delete
* Create an in-memory index object.
[189] Fix | Delete
*
[190] Fix | Delete
* This index object cannot be read/written to the filesystem,
[191] Fix | Delete
* but may be used to perform in-memory index operations.
[192] Fix | Delete
*
[193] Fix | Delete
* The index must be freed once it's no longer in use.
[194] Fix | Delete
*
[195] Fix | Delete
* @param out the pointer for the new index
[196] Fix | Delete
* @return 0 or an error code
[197] Fix | Delete
*/
[198] Fix | Delete
GIT_EXTERN(int) git_index_new(git_index **out);
[199] Fix | Delete
[200] Fix | Delete
/**
[201] Fix | Delete
* Free an existing index object.
[202] Fix | Delete
*
[203] Fix | Delete
* @param index an existing index object
[204] Fix | Delete
*/
[205] Fix | Delete
GIT_EXTERN(void) git_index_free(git_index *index);
[206] Fix | Delete
[207] Fix | Delete
/**
[208] Fix | Delete
* Get the repository this index relates to
[209] Fix | Delete
*
[210] Fix | Delete
* @param index The index
[211] Fix | Delete
* @return A pointer to the repository
[212] Fix | Delete
*/
[213] Fix | Delete
GIT_EXTERN(git_repository *) git_index_owner(const git_index *index);
[214] Fix | Delete
[215] Fix | Delete
/**
[216] Fix | Delete
* Read index capabilities flags.
[217] Fix | Delete
*
[218] Fix | Delete
* @param index An existing index object
[219] Fix | Delete
* @return A combination of GIT_INDEX_CAPABILITY values
[220] Fix | Delete
*/
[221] Fix | Delete
GIT_EXTERN(int) git_index_caps(const git_index *index);
[222] Fix | Delete
[223] Fix | Delete
/**
[224] Fix | Delete
* Set index capabilities flags.
[225] Fix | Delete
*
[226] Fix | Delete
* If you pass `GIT_INDEX_CAPABILITY_FROM_OWNER` for the caps, then
[227] Fix | Delete
* capabilities will be read from the config of the owner object,
[228] Fix | Delete
* looking at `core.ignorecase`, `core.filemode`, `core.symlinks`.
[229] Fix | Delete
*
[230] Fix | Delete
* @param index An existing index object
[231] Fix | Delete
* @param caps A combination of GIT_INDEX_CAPABILITY values
[232] Fix | Delete
* @return 0 on success, -1 on failure
[233] Fix | Delete
*/
[234] Fix | Delete
GIT_EXTERN(int) git_index_set_caps(git_index *index, int caps);
[235] Fix | Delete
[236] Fix | Delete
/**
[237] Fix | Delete
* Get index on-disk version.
[238] Fix | Delete
*
[239] Fix | Delete
* Valid return values are 2, 3, or 4. If 3 is returned, an index
[240] Fix | Delete
* with version 2 may be written instead, if the extension data in
[241] Fix | Delete
* version 3 is not necessary.
[242] Fix | Delete
*
[243] Fix | Delete
* @param index An existing index object
[244] Fix | Delete
* @return the index version
[245] Fix | Delete
*/
[246] Fix | Delete
GIT_EXTERN(unsigned int) git_index_version(git_index *index);
[247] Fix | Delete
[248] Fix | Delete
/**
[249] Fix | Delete
* Set index on-disk version.
[250] Fix | Delete
*
[251] Fix | Delete
* Valid values are 2, 3, or 4. If 2 is given, git_index_write may
[252] Fix | Delete
* write an index with version 3 instead, if necessary to accurately
[253] Fix | Delete
* represent the index.
[254] Fix | Delete
*
[255] Fix | Delete
* @param index An existing index object
[256] Fix | Delete
* @param version The new version number
[257] Fix | Delete
* @return 0 on success, -1 on failure
[258] Fix | Delete
*/
[259] Fix | Delete
GIT_EXTERN(int) git_index_set_version(git_index *index, unsigned int version);
[260] Fix | Delete
[261] Fix | Delete
/**
[262] Fix | Delete
* Update the contents of an existing index object in memory by reading
[263] Fix | Delete
* from the hard disk.
[264] Fix | Delete
*
[265] Fix | Delete
* If `force` is true, this performs a "hard" read that discards in-memory
[266] Fix | Delete
* changes and always reloads the on-disk index data. If there is no
[267] Fix | Delete
* on-disk version, the index will be cleared.
[268] Fix | Delete
*
[269] Fix | Delete
* If `force` is false, this does a "soft" read that reloads the index
[270] Fix | Delete
* data from disk only if it has changed since the last time it was
[271] Fix | Delete
* loaded. Purely in-memory index data will be untouched. Be aware: if
[272] Fix | Delete
* there are changes on disk, unwritten in-memory changes are discarded.
[273] Fix | Delete
*
[274] Fix | Delete
* @param index an existing index object
[275] Fix | Delete
* @param force if true, always reload, vs. only read if file has changed
[276] Fix | Delete
* @return 0 or an error code
[277] Fix | Delete
*/
[278] Fix | Delete
GIT_EXTERN(int) git_index_read(git_index *index, int force);
[279] Fix | Delete
[280] Fix | Delete
/**
[281] Fix | Delete
* Write an existing index object from memory back to disk
[282] Fix | Delete
* using an atomic file lock.
[283] Fix | Delete
*
[284] Fix | Delete
* @param index an existing index object
[285] Fix | Delete
* @return 0 or an error code
[286] Fix | Delete
*/
[287] Fix | Delete
GIT_EXTERN(int) git_index_write(git_index *index);
[288] Fix | Delete
[289] Fix | Delete
/**
[290] Fix | Delete
* Get the full path to the index file on disk.
[291] Fix | Delete
*
[292] Fix | Delete
* @param index an existing index object
[293] Fix | Delete
* @return path to index file or NULL for in-memory index
[294] Fix | Delete
*/
[295] Fix | Delete
GIT_EXTERN(const char *) git_index_path(const git_index *index);
[296] Fix | Delete
[297] Fix | Delete
/**
[298] Fix | Delete
* Get the checksum of the index
[299] Fix | Delete
*
[300] Fix | Delete
* This checksum is the SHA-1 hash over the index file (except the
[301] Fix | Delete
* last 20 bytes which are the checksum itself). In cases where the
[302] Fix | Delete
* index does not exist on-disk, it will be zeroed out.
[303] Fix | Delete
*
[304] Fix | Delete
* @param index an existing index object
[305] Fix | Delete
* @return a pointer to the checksum of the index
[306] Fix | Delete
*/
[307] Fix | Delete
GIT_EXTERN(const git_oid *) git_index_checksum(git_index *index);
[308] Fix | Delete
[309] Fix | Delete
/**
[310] Fix | Delete
* Read a tree into the index file with stats
[311] Fix | Delete
*
[312] Fix | Delete
* The current index contents will be replaced by the specified tree.
[313] Fix | Delete
*
[314] Fix | Delete
* @param index an existing index object
[315] Fix | Delete
* @param tree tree to read
[316] Fix | Delete
* @return 0 or an error code
[317] Fix | Delete
*/
[318] Fix | Delete
GIT_EXTERN(int) git_index_read_tree(git_index *index, const git_tree *tree);
[319] Fix | Delete
[320] Fix | Delete
/**
[321] Fix | Delete
* Write the index as a tree
[322] Fix | Delete
*
[323] Fix | Delete
* This method will scan the index and write a representation
[324] Fix | Delete
* of its current state back to disk; it recursively creates
[325] Fix | Delete
* tree objects for each of the subtrees stored in the index,
[326] Fix | Delete
* but only returns the OID of the root tree. This is the OID
[327] Fix | Delete
* that can be used e.g. to create a commit.
[328] Fix | Delete
*
[329] Fix | Delete
* The index instance cannot be bare, and needs to be associated
[330] Fix | Delete
* to an existing repository.
[331] Fix | Delete
*
[332] Fix | Delete
* The index must not contain any file in conflict.
[333] Fix | Delete
*
[334] Fix | Delete
* @param out Pointer where to store the OID of the written tree
[335] Fix | Delete
* @param index Index to write
[336] Fix | Delete
* @return 0 on success, GIT_EUNMERGED when the index is not clean
[337] Fix | Delete
* or an error code
[338] Fix | Delete
*/
[339] Fix | Delete
GIT_EXTERN(int) git_index_write_tree(git_oid *out, git_index *index);
[340] Fix | Delete
[341] Fix | Delete
/**
[342] Fix | Delete
* Write the index as a tree to the given repository
[343] Fix | Delete
*
[344] Fix | Delete
* This method will do the same as `git_index_write_tree`, but
[345] Fix | Delete
* letting the user choose the repository where the tree will
[346] Fix | Delete
* be written.
[347] Fix | Delete
*
[348] Fix | Delete
* The index must not contain any file in conflict.
[349] Fix | Delete
*
[350] Fix | Delete
* @param out Pointer where to store OID of the the written tree
[351] Fix | Delete
* @param index Index to write
[352] Fix | Delete
* @param repo Repository where to write the tree
[353] Fix | Delete
* @return 0 on success, GIT_EUNMERGED when the index is not clean
[354] Fix | Delete
* or an error code
[355] Fix | Delete
*/
[356] Fix | Delete
GIT_EXTERN(int) git_index_write_tree_to(git_oid *out, git_index *index, git_repository *repo);
[357] Fix | Delete
[358] Fix | Delete
/**@}*/
[359] Fix | Delete
[360] Fix | Delete
/** @name Raw Index Entry Functions
[361] Fix | Delete
*
[362] Fix | Delete
* These functions work on index entries, and allow for raw manipulation
[363] Fix | Delete
* of the entries.
[364] Fix | Delete
*/
[365] Fix | Delete
/**@{*/
[366] Fix | Delete
[367] Fix | Delete
/* Index entry manipulation */
[368] Fix | Delete
[369] Fix | Delete
/**
[370] Fix | Delete
* Get the count of entries currently in the index
[371] Fix | Delete
*
[372] Fix | Delete
* @param index an existing index object
[373] Fix | Delete
* @return integer of count of current entries
[374] Fix | Delete
*/
[375] Fix | Delete
GIT_EXTERN(size_t) git_index_entrycount(const git_index *index);
[376] Fix | Delete
[377] Fix | Delete
/**
[378] Fix | Delete
* Clear the contents (all the entries) of an index object.
[379] Fix | Delete
*
[380] Fix | Delete
* This clears the index object in memory; changes must be explicitly
[381] Fix | Delete
* written to disk for them to take effect persistently.
[382] Fix | Delete
*
[383] Fix | Delete
* @param index an existing index object
[384] Fix | Delete
* @return 0 on success, error code < 0 on failure
[385] Fix | Delete
*/
[386] Fix | Delete
GIT_EXTERN(int) git_index_clear(git_index *index);
[387] Fix | Delete
[388] Fix | Delete
/**
[389] Fix | Delete
* Get a pointer to one of the entries in the index
[390] Fix | Delete
*
[391] Fix | Delete
* The entry is not modifiable and should not be freed. Because the
[392] Fix | Delete
* `git_index_entry` struct is a publicly defined struct, you should
[393] Fix | Delete
* be able to make your own permanent copy of the data if necessary.
[394] Fix | Delete
*
[395] Fix | Delete
* @param index an existing index object
[396] Fix | Delete
* @param n the position of the entry
[397] Fix | Delete
* @return a pointer to the entry; NULL if out of bounds
[398] Fix | Delete
*/
[399] Fix | Delete
GIT_EXTERN(const git_index_entry *) git_index_get_byindex(
[400] Fix | Delete
git_index *index, size_t n);
[401] Fix | Delete
[402] Fix | Delete
/**
[403] Fix | Delete
* Get a pointer to one of the entries in the index
[404] Fix | Delete
*
[405] Fix | Delete
* The entry is not modifiable and should not be freed. Because the
[406] Fix | Delete
* `git_index_entry` struct is a publicly defined struct, you should
[407] Fix | Delete
* be able to make your own permanent copy of the data if necessary.
[408] Fix | Delete
*
[409] Fix | Delete
* @param index an existing index object
[410] Fix | Delete
* @param path path to search
[411] Fix | Delete
* @param stage stage to search
[412] Fix | Delete
* @return a pointer to the entry; NULL if it was not found
[413] Fix | Delete
*/
[414] Fix | Delete
GIT_EXTERN(const git_index_entry *) git_index_get_bypath(
[415] Fix | Delete
git_index *index, const char *path, int stage);
[416] Fix | Delete
[417] Fix | Delete
/**
[418] Fix | Delete
* Remove an entry from the index
[419] Fix | Delete
*
[420] Fix | Delete
* @param index an existing index object
[421] Fix | Delete
* @param path path to search
[422] Fix | Delete
* @param stage stage to search
[423] Fix | Delete
* @return 0 or an error code
[424] Fix | Delete
*/
[425] Fix | Delete
GIT_EXTERN(int) git_index_remove(git_index *index, const char *path, int stage);
[426] Fix | Delete
[427] Fix | Delete
/**
[428] Fix | Delete
* Remove all entries from the index under a given directory
[429] Fix | Delete
*
[430] Fix | Delete
* @param index an existing index object
[431] Fix | Delete
* @param dir container directory path
[432] Fix | Delete
* @param stage stage to search
[433] Fix | Delete
* @return 0 or an error code
[434] Fix | Delete
*/
[435] Fix | Delete
GIT_EXTERN(int) git_index_remove_directory(
[436] Fix | Delete
git_index *index, const char *dir, int stage);
[437] Fix | Delete
[438] Fix | Delete
/**
[439] Fix | Delete
* Add or update an index entry from an in-memory struct
[440] Fix | Delete
*
[441] Fix | Delete
* If a previous index entry exists that has the same path and stage
[442] Fix | Delete
* as the given 'source_entry', it will be replaced. Otherwise, the
[443] Fix | Delete
* 'source_entry' will be added.
[444] Fix | Delete
*
[445] Fix | Delete
* A full copy (including the 'path' string) of the given
[446] Fix | Delete
* 'source_entry' will be inserted on the index.
[447] Fix | Delete
*
[448] Fix | Delete
* @param index an existing index object
[449] Fix | Delete
* @param source_entry new entry object
[450] Fix | Delete
* @return 0 or an error code
[451] Fix | Delete
*/
[452] Fix | Delete
GIT_EXTERN(int) git_index_add(git_index *index, const git_index_entry *source_entry);
[453] Fix | Delete
[454] Fix | Delete
/**
[455] Fix | Delete
* Return the stage number from a git index entry
[456] Fix | Delete
*
[457] Fix | Delete
* This entry is calculated from the entry's flag attribute like this:
[458] Fix | Delete
*
[459] Fix | Delete
* (entry->flags & GIT_INDEX_ENTRY_STAGEMASK) >> GIT_INDEX_ENTRY_STAGESHIFT
[460] Fix | Delete
*
[461] Fix | Delete
* @param entry The entry
[462] Fix | Delete
* @return the stage number
[463] Fix | Delete
*/
[464] Fix | Delete
GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
[465] Fix | Delete
[466] Fix | Delete
/**
[467] Fix | Delete
* Return whether the given index entry is a conflict (has a high stage
[468] Fix | Delete
* entry). This is simply shorthand for `git_index_entry_stage > 0`.
[469] Fix | Delete
*
[470] Fix | Delete
* @param entry The entry
[471] Fix | Delete
* @return 1 if the entry is a conflict entry, 0 otherwise
[472] Fix | Delete
*/
[473] Fix | Delete
GIT_EXTERN(int) git_index_entry_is_conflict(const git_index_entry *entry);
[474] Fix | Delete
[475] Fix | Delete
/**@}*/
[476] Fix | Delete
[477] Fix | Delete
/** @name Index Entry Iteration Functions
[478] Fix | Delete
*
[479] Fix | Delete
* These functions provide an iterator for index entries.
[480] Fix | Delete
*/
[481] Fix | Delete
/**@{*/
[482] Fix | Delete
[483] Fix | Delete
/**
[484] Fix | Delete
* Create an iterator that will return every entry contained in the
[485] Fix | Delete
* index at the time of creation. Entries are returned in order,
[486] Fix | Delete
* sorted by path. This iterator is backed by a snapshot that allows
[487] Fix | Delete
* callers to modify the index while iterating without affecting the
[488] Fix | Delete
* iterator.
[489] Fix | Delete
*
[490] Fix | Delete
* @param iterator_out The newly created iterator
[491] Fix | Delete
* @param index The index to iterate
[492] Fix | Delete
*/
[493] Fix | Delete
GIT_EXTERN(int) git_index_iterator_new(
[494] Fix | Delete
git_index_iterator **iterator_out,
[495] Fix | Delete
git_index *index);
[496] Fix | Delete
[497] Fix | Delete
/**
[498] Fix | Delete
* Return the next index entry in-order from the iterator.
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function