vendor/libgit2/include/git2/index.h in rugged-0.27.10 vs vendor/libgit2/include/git2/index.h in rugged-0.27.10.1
- old
+ new
@@ -35,15 +35,15 @@
* This is a public structure that represents a file entry in the index.
* The meaning of the fields corresponds to core Git's documentation (in
* "Documentation/technical/index-format.txt").
*
* The `flags` field consists of a number of bit fields which can be
- * accessed via the first set of `GIT_INDEX_ENTRY_...` bitmasks below.
- * These flags are all read from and persisted to disk.
+ * accessed via the first set of `GIT_IDXENTRY_...` bitmasks below. These
+ * flags are all read from and persisted to disk.
*
* The `flags_extended` field also has a number of bit fields which can be
- * accessed via the later `GIT_INDEX_ENTRY_...` bitmasks below. Some of
+ * accessed via the later `GIT_IDXENTRY_...` bitmasks below. Some of
* these flags are read from and written to disk, but some are set aside
* for in-memory only reference.
*
* Note that the time and size fields are truncated to 32 bits. This
* is enough to detect changes, which is enough for the index to
@@ -74,37 +74,36 @@
*
* These bitmasks match the four fields in the `git_index_entry` `flags`
* value both in memory and on disk. You can use them to interpret the
* data in the `flags`.
*/
+#define GIT_IDXENTRY_NAMEMASK (0x0fff)
+#define GIT_IDXENTRY_STAGEMASK (0x3000)
+#define GIT_IDXENTRY_STAGESHIFT 12
-#define GIT_INDEX_ENTRY_NAMEMASK (0x0fff)
-#define GIT_INDEX_ENTRY_STAGEMASK (0x3000)
-#define GIT_INDEX_ENTRY_STAGESHIFT 12
-
/**
* Flags for index entries
*/
typedef enum {
- GIT_INDEX_ENTRY_EXTENDED = (0x4000),
- GIT_INDEX_ENTRY_VALID = (0x8000),
-} git_index_entry_flag_t;
+ GIT_IDXENTRY_EXTENDED = (0x4000),
+ GIT_IDXENTRY_VALID = (0x8000),
+} git_indxentry_flag_t;
-#define GIT_INDEX_ENTRY_STAGE(E) \
- (((E)->flags & GIT_INDEX_ENTRY_STAGEMASK) >> GIT_INDEX_ENTRY_STAGESHIFT)
+#define GIT_IDXENTRY_STAGE(E) \
+ (((E)->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT)
-#define GIT_INDEX_ENTRY_STAGE_SET(E,S) do { \
- (E)->flags = ((E)->flags & ~GIT_INDEX_ENTRY_STAGEMASK) | \
- (((S) & 0x03) << GIT_INDEX_ENTRY_STAGESHIFT); } while (0)
+#define GIT_IDXENTRY_STAGE_SET(E,S) do { \
+ (E)->flags = ((E)->flags & ~GIT_IDXENTRY_STAGEMASK) | \
+ (((S) & 0x03) << GIT_IDXENTRY_STAGESHIFT); } while (0)
/**
* Bitmasks for on-disk fields of `git_index_entry`'s `flags_extended`
*
* In memory, the `flags_extended` fields are divided into two parts: the
* fields that are read from and written to disk, and other fields that
* in-memory only and used by libgit2. Only the flags in
- * `GIT_INDEX_ENTRY_EXTENDED_FLAGS` will get saved on-disk.
+ * `GIT_IDXENTRY_EXTENDED_FLAGS` will get saved on-disk.
*
* Thee first three bitmasks match the three fields in the
* `git_index_entry` `flags_extended` value that belong on disk. You
* can use them to interpret the data in the `flags_extended`.
*
@@ -112,40 +111,51 @@
* `flags_extended` value that are only used in-memory by libgit2.
* You can use them to interpret the data in the `flags_extended`.
*
*/
typedef enum {
- GIT_INDEX_ENTRY_INTENT_TO_ADD = (1 << 13),
- GIT_INDEX_ENTRY_SKIP_WORKTREE = (1 << 14),
- GIT_INDEX_ENTRY_EXTENDED_FLAGS = (GIT_INDEX_ENTRY_INTENT_TO_ADD | GIT_INDEX_ENTRY_SKIP_WORKTREE),
+ GIT_IDXENTRY_INTENT_TO_ADD = (1 << 13),
+ GIT_IDXENTRY_SKIP_WORKTREE = (1 << 14),
+ /** Reserved for future extension */
+ GIT_IDXENTRY_EXTENDED2 = (1 << 15),
- GIT_INDEX_ENTRY_UPTODATE = (1 << 2),
-} git_index_entry_extended_flag_t;
+ GIT_IDXENTRY_EXTENDED_FLAGS = (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE),
+ GIT_IDXENTRY_UPDATE = (1 << 0),
+ GIT_IDXENTRY_REMOVE = (1 << 1),
+ GIT_IDXENTRY_UPTODATE = (1 << 2),
+ GIT_IDXENTRY_ADDED = (1 << 3),
+ GIT_IDXENTRY_HASHED = (1 << 4),
+ GIT_IDXENTRY_UNHASHED = (1 << 5),
+ GIT_IDXENTRY_WT_REMOVE = (1 << 6), /**< remove in work directory */
+ GIT_IDXENTRY_CONFLICTED = (1 << 7),
+
+ GIT_IDXENTRY_UNPACKED = (1 << 8),
+ GIT_IDXENTRY_NEW_SKIP_WORKTREE = (1 << 9),
+} git_idxentry_extended_flag_t;
+
/** Capabilities of system that affect index actions. */
typedef enum {
- GIT_INDEX_CAPABILITY_IGNORE_CASE = 1,
- GIT_INDEX_CAPABILITY_NO_FILEMODE = 2,
- GIT_INDEX_CAPABILITY_NO_SYMLINKS = 4,
- GIT_INDEX_CAPABILITY_FROM_OWNER = -1,
-} git_index_capability_t;
+ GIT_INDEXCAP_IGNORE_CASE = 1,
+ GIT_INDEXCAP_NO_FILEMODE = 2,
+ GIT_INDEXCAP_NO_SYMLINKS = 4,
+ GIT_INDEXCAP_FROM_OWNER = -1,
+} git_indexcap_t;
-
/** Callback for APIs that add/remove/update files matching pathspec */
-typedef int GIT_CALLBACK(git_index_matched_path_cb)(
+typedef int (*git_index_matched_path_cb)(
const char *path, const char *matched_pathspec, void *payload);
/** Flags for APIs that add files matching pathspec */
typedef enum {
GIT_INDEX_ADD_DEFAULT = 0,
GIT_INDEX_ADD_FORCE = (1u << 0),
GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH = (1u << 1),
GIT_INDEX_ADD_CHECK_PATHSPEC = (1u << 2),
} git_index_add_option_t;
-/** Git index stage states */
typedef enum {
/**
* Match any index stage.
*
* Some index APIs take a stage to match; pass this value to match
@@ -164,10 +174,16 @@
/** The "theirs" side of a conflict. */
GIT_INDEX_STAGE_THEIRS = 3,
} git_index_stage_t;
+/** @name Index File Functions
+ *
+ * These functions work on the index file itself.
+ */
+/**@{*/
+
/**
* Create a new bare Git index object as a memory representation
* of the Git index file in 'index_path', without a repository
* to back it.
*
@@ -216,23 +232,23 @@
/**
* Read index capabilities flags.
*
* @param index An existing index object
- * @return A combination of GIT_INDEX_CAPABILITY values
+ * @return A combination of GIT_INDEXCAP values
*/
GIT_EXTERN(int) git_index_caps(const git_index *index);
/**
* Set index capabilities flags.
*
- * If you pass `GIT_INDEX_CAPABILITY_FROM_OWNER` for the caps, then
+ * If you pass `GIT_INDEXCAP_FROM_OWNER` for the caps, then the
* capabilities will be read from the config of the owner object,
* looking at `core.ignorecase`, `core.filemode`, `core.symlinks`.
*
* @param index An existing index object
- * @param caps A combination of GIT_INDEX_CAPABILITY values
+ * @param caps A combination of GIT_INDEXCAP values
* @return 0 on success, -1 on failure
*/
GIT_EXTERN(int) git_index_set_caps(git_index *index, int caps);
/**
@@ -456,11 +472,11 @@
/**
* Return the stage number from a git index entry
*
* This entry is calculated from the entry's flag attribute like this:
*
- * (entry->flags & GIT_INDEX_ENTRY_STAGEMASK) >> GIT_INDEX_ENTRY_STAGESHIFT
+ * (entry->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT
*
* @param entry The entry
* @return the stage number
*/
GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
@@ -474,50 +490,10 @@
*/
GIT_EXTERN(int) git_index_entry_is_conflict(const git_index_entry *entry);
/**@}*/
-/** @name Index Entry Iteration Functions
- *
- * These functions provide an iterator for index entries.
- */
-/**@{*/
-
-/**
- * Create an iterator that will return every entry contained in the
- * index at the time of creation. Entries are returned in order,
- * sorted by path. This iterator is backed by a snapshot that allows
- * callers to modify the index while iterating without affecting the
- * iterator.
- *
- * @param iterator_out The newly created iterator
- * @param index The index to iterate
- */
-GIT_EXTERN(int) git_index_iterator_new(
- git_index_iterator **iterator_out,
- git_index *index);
-
-/**
- * Return the next index entry in-order from the iterator.
- *
- * @param out Pointer to store the index entry in
- * @param iterator The iterator
- * @return 0, GIT_ITEROVER on iteration completion or an error code
- */
-GIT_EXTERN(int) git_index_iterator_next(
- const git_index_entry **out,
- git_index_iterator *iterator);
-
-/**
- * Free the index iterator
- *
- * @param iterator The iterator to free
- */
-GIT_EXTERN(void) git_index_iterator_free(git_index_iterator *iterator);
-
-/**@}*/
-
/** @name Workdir Index Entry Functions
*
* These functions work on index entries specifically in the working
* directory (ie, stage 0).
*/
@@ -570,11 +546,11 @@
* @param entry filename to add
* @param buffer data to be written into the blob
* @param len length of the data
* @return 0 or an error code
*/
-GIT_EXTERN(int) git_index_add_from_buffer(
+GIT_EXTERN(int) git_index_add_frombuffer(
git_index *index,
const git_index_entry *entry,
const void *buffer, size_t len);
/**
@@ -826,9 +802,11 @@
*
* @param iterator pointer to the iterator
*/
GIT_EXTERN(void) git_index_conflict_iterator_free(
git_index_conflict_iterator *iterator);
+
+/**@}*/
/** @} */
GIT_END_DECL
#endif