Unverified Commit 788fccc4 by Edward Thomson Committed by GitHub

Merge pull request #4807 from libgit2/ethomson/index_fixes

Index API updates for consistency
parents 0ddc6094 168fe39b
......@@ -243,13 +243,13 @@ typedef enum {
* > `GIT_CONFIG_LEVEL_GLOBAL`, `GIT_CONFIG_LEVEL_XDG`, or
* > `GIT_CONFIG_LEVEL_PROGRAMDATA`.
*
* * opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, git_otype type, size_t size)
* * opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, git_object_t type, size_t size)
*
* > Set the maximum data size for the given type of object to be
* > considered eligible for caching in memory. Setting to value to
* > zero means that that type of object will not be cached.
* > Defaults to 0 for GIT_OBJ_BLOB (i.e. won't cache blobs) and 4k
* > for GIT_OBJ_COMMIT, GIT_OBJ_TREE, and GIT_OBJ_TAG.
* > Defaults to 0 for GIT_OBJECT_BLOB (i.e. won't cache blobs) and 4k
* > for GIT_OBJECT_COMMIT, GIT_OBJECT_TREE, and GIT_OBJECT_TAG.
*
* * opts(GIT_OPT_SET_CACHE_MAX_SIZE, ssize_t max_storage_bytes)
*
......
......@@ -37,11 +37,11 @@ typedef struct {
* "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_IDXENTRY_...` bitmasks below. These
* flags are all read from and persisted to disk.
* accessed via the first set of `GIT_INDEX_ENTRY_...` 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_IDXENTRY_...` bitmasks below. Some of
* accessed via the later `GIT_INDEX_ENTRY_...` bitmasks below. Some of
* these flags are read from and written to disk, but some are set aside
* for in-memory only reference.
*
......@@ -76,24 +76,25 @@ typedef struct git_index_entry {
* 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_IDXENTRY_EXTENDED = (0x4000),
GIT_IDXENTRY_VALID = (0x8000),
} git_indxentry_flag_t;
GIT_INDEX_ENTRY_EXTENDED = (0x4000),
GIT_INDEX_ENTRY_VALID = (0x8000),
} git_index_entry_flag_t;
#define GIT_IDXENTRY_STAGE(E) \
(((E)->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT)
#define GIT_INDEX_ENTRY_STAGE(E) \
(((E)->flags & GIT_INDEX_ENTRY_STAGEMASK) >> GIT_INDEX_ENTRY_STAGESHIFT)
#define GIT_IDXENTRY_STAGE_SET(E,S) do { \
(E)->flags = ((E)->flags & ~GIT_IDXENTRY_STAGEMASK) | \
(((S) & 0x03) << GIT_IDXENTRY_STAGESHIFT); } while (0)
#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)
/**
* Bitmasks for on-disk fields of `git_index_entry`'s `flags_extended`
......@@ -101,7 +102,7 @@ typedef enum {
* 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_IDXENTRY_EXTENDED_FLAGS` will get saved on-disk.
* `GIT_INDEX_ENTRY_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
......@@ -113,34 +114,22 @@ typedef enum {
*
*/
typedef enum {
GIT_INDEX_ENTRY_INTENT_TO_ADD = (1 << 13),
GIT_INDEX_ENTRY_SKIP_WORKTREE = (1 << 14),
GIT_IDXENTRY_INTENT_TO_ADD = (1 << 13),
GIT_IDXENTRY_SKIP_WORKTREE = (1 << 14),
/** Reserved for future extension */
GIT_IDXENTRY_EXTENDED2 = (1 << 15),
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_INDEX_ENTRY_EXTENDED_FLAGS = (GIT_INDEX_ENTRY_INTENT_TO_ADD | GIT_INDEX_ENTRY_SKIP_WORKTREE),
GIT_IDXENTRY_UNPACKED = (1 << 8),
GIT_IDXENTRY_NEW_SKIP_WORKTREE = (1 << 9),
} git_idxentry_extended_flag_t;
GIT_INDEX_ENTRY_UPTODATE = (1 << 2),
} git_index_entry_extended_flag_t;
/** Capabilities of system that affect index actions. */
typedef enum {
GIT_INDEXCAP_IGNORE_CASE = 1,
GIT_INDEXCAP_NO_FILEMODE = 2,
GIT_INDEXCAP_NO_SYMLINKS = 4,
GIT_INDEXCAP_FROM_OWNER = -1,
} git_indexcap_t;
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;
/** Callback for APIs that add/remove/update files matching pathspec */
typedef int (*git_index_matched_path_cb)(
......@@ -234,19 +223,19 @@ GIT_EXTERN(git_repository *) git_index_owner(const git_index *index);
* Read index capabilities flags.
*
* @param index An existing index object
* @return A combination of GIT_INDEXCAP values
* @return A combination of GIT_INDEX_CAPABILITY values
*/
GIT_EXTERN(int) git_index_caps(const git_index *index);
/**
* Set index capabilities flags.
*
* If you pass `GIT_INDEXCAP_FROM_OWNER` for the caps, then the
* If you pass `GIT_INDEX_CAPABILITY_FROM_OWNER` for the caps, then
* 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_INDEXCAP values
* @param caps A combination of GIT_INDEX_CAPABILITY values
* @return 0 on success, -1 on failure
*/
GIT_EXTERN(int) git_index_set_caps(git_index *index, int caps);
......@@ -474,7 +463,7 @@ GIT_EXTERN(int) git_index_add(git_index *index, const git_index_entry *source_en
*
* This entry is calculated from the entry's flag attribute like this:
*
* (entry->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT
* (entry->flags & GIT_INDEX_ENTRY_STAGEMASK) >> GIT_INDEX_ENTRY_STAGESHIFT
*
* @param entry The entry
* @return the stage number
......@@ -847,6 +836,49 @@ GIT_EXTERN(void) git_index_conflict_iterator_free(
/**@}*/
/** @name Deprecated Index Structures
*
* These macros, structures and enumerations are retained for backward
* compatibility. The newer versions of these functions and structures
* should be preferred in all new code.
*/
/**@{*/
#define GIT_IDXENTRY_NAMEMASK GIT_INDEX_ENTRY_NAMEMASK
#define GIT_IDXENTRY_STAGEMASK GIT_INDEX_ENTRY_STAGEMASK
#define GIT_IDXENTRY_STAGESHIFT GIT_INDEX_ENTRY_STAGESHIFT
/* The git_indxentry_flag_t enum */
#define GIT_IDXENTRY_EXTENDED GIT_INDEX_ENTRY_EXTENDED
#define GIT_IDXENTRY_VALID GIT_INDEX_ENTRY_VALID
#define GIT_IDXENTRY_STAGE(E) GIT_INDEX_ENTRY_STAGE(E)
#define GIT_IDXENTRY_STAGE_SET(E,S) GIT_INDEX_ENTRY_STAGE_SET(E,S)
/* The git_idxentry_extended_flag_t enum */
#define GIT_IDXENTRY_INTENT_TO_ADD GIT_INDEX_ENTRY_INTENT_TO_ADD
#define GIT_IDXENTRY_SKIP_WORKTREE GIT_INDEX_ENTRY_SKIP_WORKTREE
#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_INDEX_ENTRY_INTENT_TO_ADD | GIT_INDEX_ENTRY_SKIP_WORKTREE)
#define GIT_IDXENTRY_EXTENDED2 (1 << 15)
#define GIT_IDXENTRY_UPDATE (1 << 0)
#define GIT_IDXENTRY_REMOVE (1 << 1)
#define GIT_IDXENTRY_UPTODATE (1 << 2)
#define GIT_IDXENTRY_ADDED (1 << 3)
#define GIT_IDXENTRY_HASHED (1 << 4)
#define GIT_IDXENTRY_UNHASHED (1 << 5)
#define GIT_IDXENTRY_WT_REMOVE (1 << 6)
#define GIT_IDXENTRY_CONFLICTED (1 << 7)
#define GIT_IDXENTRY_UNPACKED (1 << 8)
#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
/* The git_index_capability_t enum */
#define GIT_INDEXCAP_IGNORE_CASE GIT_INDEX_CAPABILITY_IGNORE_CASE
#define GIT_INDEXCAP_NO_FILEMODE GIT_INDEX_CAPABILITY_NO_FILEMODE
#define GIT_INDEXCAP_NO_SYMLINKS GIT_INDEX_CAPABILITY_NO_SYMLINKS
#define GIT_INDEXCAP_FROM_OWNER GIT_INDEX_CAPABILITY_FROM_OWNER
/**@}*/
/** @} */
GIT_END_DECL
#endif
......@@ -30,7 +30,7 @@ GIT_BEGIN_DECL
*
* The 'type' parameter must match the type of the object
* in the odb; the method will fail otherwise.
* The special value 'GIT_OBJ_ANY' may be passed to let
* The special value 'GIT_OBJECT_ANY' may be passed to let
* the method guess the object's type.
*
* @param object pointer to the looked-up object
......@@ -43,7 +43,7 @@ GIT_EXTERN(int) git_object_lookup(
git_object **object,
git_repository *repo,
const git_oid *id,
git_otype type);
git_object_t type);
/**
* Lookup a reference to one of the objects in a repository,
......@@ -62,7 +62,7 @@ GIT_EXTERN(int) git_object_lookup(
*
* The 'type' parameter must match the type of the object
* in the odb; the method will fail otherwise.
* The special value 'GIT_OBJ_ANY' may be passed to let
* The special value 'GIT_OBJECT_ANY' may be passed to let
* the method guess the object's type.
*
* @param object_out pointer where to store the looked-up object
......@@ -77,7 +77,7 @@ GIT_EXTERN(int) git_object_lookup_prefix(
git_repository *repo,
const git_oid *id,
size_t len,
git_otype type);
git_object_t type);
/**
......@@ -94,7 +94,7 @@ GIT_EXTERN(int) git_object_lookup_bypath(
git_object **out,
const git_object *treeish,
const char *path,
git_otype type);
git_object_t type);
/**
* Get the id (SHA1) of a repository object
......@@ -124,7 +124,7 @@ GIT_EXTERN(int) git_object_short_id(git_buf *out, const git_object *obj);
* @param obj the repository object
* @return the object's type
*/
GIT_EXTERN(git_otype) git_object_type(const git_object *obj);
GIT_EXTERN(git_object_t) git_object_type(const git_object *obj);
/**
* Get the repository that owns this object
......@@ -166,24 +166,24 @@ GIT_EXTERN(void) git_object_free(git_object *object);
* @param type object type to convert.
* @return the corresponding string representation.
*/
GIT_EXTERN(const char *) git_object_type2string(git_otype type);
GIT_EXTERN(const char *) git_object_type2string(git_object_t type);
/**
* Convert a string object type representation to it's git_otype.
* Convert a string object type representation to it's git_object_t.
*
* @param str the string to convert.
* @return the corresponding git_otype.
* @return the corresponding git_object_t.
*/
GIT_EXTERN(git_otype) git_object_string2type(const char *str);
GIT_EXTERN(git_object_t) git_object_string2type(const char *str);
/**
* Determine if the given git_otype is a valid loose object type.
* Determine if the given git_object_t is a valid loose object type.
*
* @param type object type to test.
* @return true if the type represents a valid loose object type,
* false otherwise.
*/
GIT_EXTERN(int) git_object_typeisloose(git_otype type);
GIT_EXTERN(int) git_object_typeisloose(git_object_t type);
/**
* Get the size in bytes for the structure which
......@@ -197,7 +197,7 @@ GIT_EXTERN(int) git_object_typeisloose(git_otype type);
* @param type object type to get its size
* @return size in bytes of the object
*/
GIT_EXTERN(size_t) git_object__size(git_otype type);
GIT_EXTERN(size_t) git_object__size(git_object_t type);
/**
* Recursively peel an object until an object of the specified type is met.
......@@ -206,7 +206,7 @@ GIT_EXTERN(size_t) git_object__size(git_otype type);
* GIT_EINVALIDSPEC will be returned (e.g. trying to peel a blob to a
* tree).
*
* If you pass `GIT_OBJ_ANY` as the target type, then the object will
* If you pass `GIT_OBJECT_ANY` as the target type, then the object will
* be peeled until the type changes. A tag will be peeled until the
* referenced object is no longer a tag, and a commit will be peeled
* to a tree. Any other object type will return GIT_EINVALIDSPEC.
......@@ -219,13 +219,13 @@ GIT_EXTERN(size_t) git_object__size(git_otype type);
*
* @param peeled Pointer to the peeled git_object
* @param object The object to be processed
* @param target_type The type of the requested object (a GIT_OBJ_ value)
* @param target_type The type of the requested object (a GIT_OBJECT_ value)
* @return 0 on success, GIT_EINVALIDSPEC, GIT_EPEEL, or an error code
*/
GIT_EXTERN(int) git_object_peel(
git_object **peeled,
const git_object *object,
git_otype target_type);
git_object_t target_type);
/**
* Create an in-memory copy of a Git object. The copy must be
......
......@@ -146,7 +146,7 @@ GIT_EXTERN(int) git_odb_read_prefix(git_odb_object **out, git_odb *db, const git
* - 0 if the object was read;
* - GIT_ENOTFOUND if the object is not in the database.
*/
GIT_EXTERN(int) git_odb_read_header(size_t *len_out, git_otype *type_out, git_odb *db, const git_oid *id);
GIT_EXTERN(int) git_odb_read_header(size_t *len_out, git_object_t *type_out, git_odb *db, const git_oid *id);
/**
* Determine if the given object can be found in the object database.
......@@ -189,9 +189,9 @@ typedef struct git_odb_expand_id {
/**
* The (optional) type of the object to search for; leave as `0` or set
* to `GIT_OBJ_ANY` to query for any object matching the ID.
* to `GIT_OBJECT_ANY` to query for any object matching the ID.
*/
git_otype type;
git_object_t type;
} git_odb_expand_id;
/**
......@@ -270,7 +270,7 @@ GIT_EXTERN(int) git_odb_foreach(git_odb *db, git_odb_foreach_cb cb, void *payloa
* @param type type of the data to store
* @return 0 or an error code
*/
GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size_t len, git_otype type);
GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size_t len, git_object_t type);
/**
* Open a stream to write an object into the ODB
......@@ -293,7 +293,7 @@ GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size
* @param type type of the object that will be written
* @return 0 if the stream was created; error code otherwise
*/
GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **out, git_odb *db, git_off_t size, git_otype type);
GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **out, git_odb *db, git_off_t size, git_object_t type);
/**
* Write to an odb stream
......@@ -366,7 +366,7 @@ GIT_EXTERN(void) git_odb_stream_free(git_odb_stream *stream);
GIT_EXTERN(int) git_odb_open_rstream(
git_odb_stream **out,
size_t *len,
git_otype *type,
git_object_t *type,
git_odb *db,
const git_oid *oid);
......@@ -406,7 +406,7 @@ GIT_EXTERN(int) git_odb_write_pack(
* @param type of the data to hash
* @return 0 or an error code
*/
GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_otype type);
GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_object_t type);
/**
* Read a file from disk and fill a git_oid with the object id
......@@ -421,7 +421,7 @@ GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_oty
* @param type the type of the object that will be hashed
* @return 0 or an error code
*/
GIT_EXTERN(int) git_odb_hashfile(git_oid *out, const char *path, git_otype type);
GIT_EXTERN(int) git_odb_hashfile(git_oid *out, const char *path, git_object_t type);
/**
* Create a copy of an odb_object
......@@ -487,7 +487,7 @@ GIT_EXTERN(size_t) git_odb_object_size(git_odb_object *object);
* @param object the object
* @return the type
*/
GIT_EXTERN(git_otype) git_odb_object_type(git_odb_object *object);
GIT_EXTERN(git_object_t) git_odb_object_type(git_odb_object *object);
/**
* Add a custom backend to an existing Object DB
......
......@@ -699,19 +699,19 @@ GIT_EXTERN(int) git_reference_normalize_name(
* The retrieved `peeled` object is owned by the repository
* and should be closed with the `git_object_free` method.
*
* If you pass `GIT_OBJ_ANY` as the target type, then the object
* If you pass `GIT_OBJECT_ANY` as the target type, then the object
* will be peeled until a non-tag object is met.
*
* @param out Pointer to the peeled git_object
* @param ref The reference to be processed
* @param type The type of the requested object (GIT_OBJ_COMMIT,
* GIT_OBJ_TAG, GIT_OBJ_TREE, GIT_OBJ_BLOB or GIT_OBJ_ANY).
* @param type The type of the requested object (GIT_OBJECT_COMMIT,
* GIT_OBJECT_TAG, GIT_OBJECT_TREE, GIT_OBJECT_BLOB or GIT_OBJECT_ANY).
* @return 0 on success, GIT_EAMBIGUOUS, GIT_ENOTFOUND or an error code
*/
GIT_EXTERN(int) git_reference_peel(
git_object **out,
git_reference *ref,
git_otype type);
git_object_t type);
/**
* Ensure the reference name is well-formed.
......
......@@ -685,7 +685,7 @@ GIT_EXTERN(int) git_repository_mergehead_foreach(
* @param repo Repository pointer
* @param path Path to file on disk whose contents should be hashed. If the
* repository is not NULL, this can be a relative path.
* @param type The object type to hash as (e.g. GIT_OBJ_BLOB)
* @param type The object type to hash as (e.g. GIT_OBJECT_BLOB)
* @param as_path The path to use to look up filtering rules. If this is
* NULL, then the `path` parameter will be used instead. If
* this is passed as the empty string, then no filters will be
......@@ -696,7 +696,7 @@ GIT_EXTERN(int) git_repository_hashfile(
git_oid *out,
git_repository *repo,
const char *path,
git_otype type,
git_object_t type,
const char *as_path);
/**
......
......@@ -33,30 +33,30 @@ struct git_odb_backend {
* the function git_odb_backend_malloc to ensure that it can
* be safely freed later. */
int (* read)(
void **, size_t *, git_otype *, git_odb_backend *, const git_oid *);
void **, size_t *, git_object_t *, git_odb_backend *, const git_oid *);
/* To find a unique object given a prefix of its oid. The oid given
* must be so that the remaining (GIT_OID_HEXSZ - len)*4 bits are 0s.
*/
int (* read_prefix)(
git_oid *, void **, size_t *, git_otype *,
git_oid *, void **, size_t *, git_object_t *,
git_odb_backend *, const git_oid *, size_t);
int (* read_header)(
size_t *, git_otype *, git_odb_backend *, const git_oid *);
size_t *, git_object_t *, git_odb_backend *, const git_oid *);
/**
* Write an object into the backend. The id of the object has
* already been calculated and is passed in.
*/
int (* write)(
git_odb_backend *, const git_oid *, const void *, size_t, git_otype);
git_odb_backend *, const git_oid *, const void *, size_t, git_object_t);
int (* writestream)(
git_odb_stream **, git_odb_backend *, git_off_t, git_otype);
git_odb_stream **, git_odb_backend *, git_off_t, git_object_t);
int (* readstream)(
git_odb_stream **, size_t *, git_otype *,
git_odb_stream **, size_t *, git_object_t *,
git_odb_backend *, const git_oid *);
int (* exists)(
......
......@@ -102,7 +102,7 @@ GIT_EXTERN(const git_oid *) git_tag_target_id(const git_tag *tag);
* @param tag a previously loaded tag.
* @return type of the tagged object
*/
GIT_EXTERN(git_otype) git_tag_target_type(const git_tag *tag);
GIT_EXTERN(git_object_t) git_tag_target_type(const git_tag *tag);
/**
* Get the name of a tag
......
......@@ -189,7 +189,7 @@ GIT_EXTERN(const git_oid *) git_tree_entry_id(const git_tree_entry *entry);
* @param entry a tree entry
* @return the type of the pointed object
*/
GIT_EXTERN(git_otype) git_tree_entry_type(const git_tree_entry *entry);
GIT_EXTERN(git_object_t) git_tree_entry_type(const git_tree_entry *entry);
/**
* Get the UNIX file attributes of a tree entry
......
......@@ -68,17 +68,15 @@ typedef int64_t git_time_t;
/** Basic type (loose or packed) of any Git object. */
typedef enum {
GIT_OBJ_ANY = -2, /**< Object can be any of the following */
GIT_OBJ_BAD = -1, /**< Object is invalid. */
GIT_OBJ__EXT1 = 0, /**< Reserved for future use. */
GIT_OBJ_COMMIT = 1, /**< A commit object. */
GIT_OBJ_TREE = 2, /**< A tree (directory listing) object. */
GIT_OBJ_BLOB = 3, /**< A file revision object. */
GIT_OBJ_TAG = 4, /**< An annotated tag object. */
GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */
GIT_OBJ_OFS_DELTA = 6, /**< A delta, base is given by an offset. */
GIT_OBJ_REF_DELTA = 7, /**< A delta, base is given by object id. */
} git_otype;
GIT_OBJECT_ANY = -2, /**< Object can be any of the following */
GIT_OBJECT_BAD = -1, /**< Object is invalid. */
GIT_OBJECT_COMMIT = 1, /**< A commit object. */
GIT_OBJECT_TREE = 2, /**< A tree (directory listing) object. */
GIT_OBJECT_BLOB = 3, /**< A file revision object. */
GIT_OBJECT_TAG = 4, /**< An annotated tag object. */
GIT_OBJECT_OFS_DELTA = 6, /**< A delta, base is given by an offset. */
GIT_OBJECT_REF_DELTA = 7, /**< A delta, base is given by object id. */
} git_object_t;
/** An open object database handle. */
typedef struct git_odb git_odb;
......@@ -443,6 +441,30 @@ struct git_writestream {
/** Representation of .mailmap file state. */
typedef struct git_mailmap git_mailmap;
/** @name Deprecated Index Structures
*
* These macros, structures and enumerations are retained for backward
* compatibility. The newer versions of these functions and structures
* should be preferred in all new code.
*/
/**@{*/
#define GIT_OBJ_ANY GIT_OBJECT_ANY
#define GIT_OBJ_BAD GIT_OBJECT_BAD
#define GIT_OBJ__EXT1 0
#define GIT_OBJ_COMMIT GIT_OBJECT_COMMIT
#define GIT_OBJ_TREE GIT_OBJECT_TREE
#define GIT_OBJ_BLOB GIT_OBJECT_BLOB
#define GIT_OBJ_TAG GIT_OBJECT_TAG
#define GIT_OBJ__EXT2 5
#define GIT_OBJ_OFS_DELTA GIT_OBJECT_OFS_DELTA
#define GIT_OBJ_REF_DELTA GIT_OBJECT_REF_DELTA
#define git_otype git_object_t
/**@}*/
/** @} */
GIT_END_DECL
......
......@@ -105,7 +105,7 @@ int git_annotated_commit_from_revspec(
if ((error = git_revparse_single(&obj, repo, revspec)) < 0)
return error;
if ((error = git_object_peel(&commit, obj, GIT_OBJ_COMMIT))) {
if ((error = git_object_peel(&commit, obj, GIT_OBJECT_COMMIT))) {
git_object_free(obj);
return error;
}
......@@ -132,7 +132,7 @@ int git_annotated_commit_from_ref(
if ((error = git_reference_resolve(&resolved, ref)) < 0)
return error;
error = annotated_commit_init_from_id(out,
repo,
git_reference_target(resolved),
......
......@@ -315,7 +315,7 @@ static int load_blob(git_blame *blame)
if (error < 0)
goto cleanup;
error = git_object_lookup_bypath((git_object**)&blame->final_blob,
(git_object*)blame->final, blame->path, GIT_OBJ_BLOB);
(git_object*)blame->final, blame->path, GIT_OBJECT_BLOB);
cleanup:
return error;
......
......@@ -43,7 +43,7 @@ static int make_origin(git_blame__origin **out, git_commit *commit, const char *
int error = 0;
if ((error = git_object_lookup_bypath(&blob, (git_object*)commit,
path, GIT_OBJ_BLOB)) < 0)
path, GIT_OBJECT_BLOB)) < 0)
return error;
GITERR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*o), path_len);
......@@ -257,7 +257,7 @@ static void split_blame(git_blame *blame, git_blame__entry *split, git_blame__en
}
}
/*
/*
* After splitting the blame, the origins used by the on-stack blame_entry
* should lose one refcnt each.
*/
......@@ -486,7 +486,7 @@ static int pass_whole_blame(git_blame *blame,
if (!porigin->blob &&
git_object_lookup((git_object**)&porigin->blob, blame->repository,
git_blob_id(origin->blob), GIT_OBJ_BLOB) < 0)
git_blob_id(origin->blob), GIT_OBJECT_BLOB) < 0)
return -1;
for (e=blame->ent; e; e=e->next) {
if (!same_suspect(e->suspect, origin))
......
......@@ -80,7 +80,7 @@ int git_blob_create_frombuffer(
assert(id && repo);
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
(error = git_odb_open_wstream(&stream, odb, len, GIT_OBJ_BLOB)) < 0)
(error = git_odb_open_wstream(&stream, odb, len, GIT_OBJECT_BLOB)) < 0)
return error;
if ((error = git_odb_stream_write(stream, buffer, len)) == 0)
......@@ -100,7 +100,7 @@ static int write_file_stream(
git_off_t written = 0;
if ((error = git_odb_open_wstream(
&stream, odb, file_size, GIT_OBJ_BLOB)) < 0)
&stream, odb, file_size, GIT_OBJECT_BLOB)) < 0)
return error;
if ((fd = git_futils_open_ro(path)) < 0) {
......@@ -143,7 +143,7 @@ static int write_file_filtered(
if (!error) {
*size = tgt.size;
error = git_odb_write(id, odb, tgt.ptr, tgt.size, GIT_OBJ_BLOB);
error = git_odb_write(id, odb, tgt.ptr, tgt.size, GIT_OBJECT_BLOB);
}
git_buf_dispose(&tgt);
......@@ -167,7 +167,7 @@ static int write_symlink(
return -1;
}
error = git_odb_write(id, odb, (void *)link_data, link_size, GIT_OBJ_BLOB);
error = git_odb_write(id, odb, (void *)link_data, link_size, GIT_OBJECT_BLOB);
git__free(link_data);
return error;
}
......
......@@ -20,17 +20,17 @@ ssize_t git_cache__max_storage = (256 * 1024 * 1024);
git_atomic_ssize git_cache__current_storage = {0};
static size_t git_cache__max_object_size[8] = {
0, /* GIT_OBJ__EXT1 */
4096, /* GIT_OBJ_COMMIT */
4096, /* GIT_OBJ_TREE */
0, /* GIT_OBJ_BLOB */
4096, /* GIT_OBJ_TAG */
0, /* GIT_OBJ__EXT2 */
0, /* GIT_OBJ_OFS_DELTA */
0 /* GIT_OBJ_REF_DELTA */
0, /* GIT_OBJECT__EXT1 */
4096, /* GIT_OBJECT_COMMIT */
4096, /* GIT_OBJECT_TREE */
0, /* GIT_OBJECT_BLOB */
4096, /* GIT_OBJECT_TAG */
0, /* GIT_OBJECT__EXT2 */
0, /* GIT_OBJECT_OFS_DELTA */
0 /* GIT_OBJECT_REF_DELTA */
};
int git_cache_set_max_object_size(git_otype type, size_t size)
int git_cache_set_max_object_size(git_object_t type, size_t size)
{
if (type < 0 || (size_t)type >= ARRAY_SIZE(git_cache__max_object_size)) {
giterr_set(GITERR_INVALID, "type out of range");
......@@ -140,7 +140,7 @@ static void cache_evict_entries(git_cache *cache)
git_atomic_ssize_add(&git_cache__current_storage, -evicted_memory);
}
static bool cache_should_store(git_otype object_type, size_t object_size)
static bool cache_should_store(git_object_t object_type, size_t object_size)
{
size_t max_size = git_cache__max_object_size[object_type];
return git_cache__enabled && object_size < max_size;
......
......@@ -24,7 +24,7 @@ enum {
typedef struct {
git_oid oid;
int16_t type; /* git_otype value */
int16_t type; /* git_object_t value */
uint16_t flags; /* GIT_CACHE_STORE value */
size_t size;
git_atomic refcount;
......@@ -40,7 +40,7 @@ extern bool git_cache__enabled;
extern ssize_t git_cache__max_storage;
extern git_atomic_ssize git_cache__current_storage;
int git_cache_set_max_object_size(git_otype type, size_t size);
int git_cache_set_max_object_size(git_object_t type, size_t size);
int git_cache_init(git_cache *cache);
void git_cache_free(git_cache *cache);
......
......@@ -1944,7 +1944,7 @@ static int checkout_lookup_head_tree(git_tree **out, git_repository *repo)
git_object *head;
if (!(error = git_repository_head(&ref, repo)) &&
!(error = git_reference_peel(&head, ref, GIT_OBJ_TREE)))
!(error = git_reference_peel(&head, ref, GIT_OBJECT_TREE)))
*out = (git_tree *)head;
git_reference_free(ref);
......@@ -2749,7 +2749,7 @@ int git_checkout_tree(
repo = git_object_owner(treeish);
if (treeish) {
if (git_object_peel((git_object **)&tree, treeish, GIT_OBJ_TREE) < 0) {
if (git_object_peel((git_object **)&tree, treeish, GIT_OBJECT_TREE) < 0) {
giterr_set(
GITERR_CHECKOUT, "provided object cannot be peeled to a tree");
return -1;
......
......@@ -198,7 +198,7 @@ int git_cherrypick(
(error = git_indexwriter_init_for_operation(&indexwriter, repo, &opts.checkout_opts.checkout_strategy)) < 0 ||
(error = write_cherrypick_head(repo, commit_oidstr)) < 0 ||
(error = git_repository_head(&our_ref, repo)) < 0 ||
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJ_COMMIT)) < 0 ||
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJECT_COMMIT)) < 0 ||
(error = git_cherrypick_commit(&index, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
(error = git_merge__check_result(repo, index)) < 0 ||
(error = git_merge__append_conflicts_to_merge_msg(repo, index)) < 0 ||
......
......@@ -88,12 +88,12 @@ static int validate_tree_and_parents(git_array_oid_t *parents, git_repository *r
git_oid *parent_cpy;
const git_oid *parent;
if (validate && !git_object__is_valid(repo, tree, GIT_OBJ_TREE))
if (validate && !git_object__is_valid(repo, tree, GIT_OBJECT_TREE))
return -1;
i = 0;
while ((parent = parent_cb(i, parent_payload)) != NULL) {
if (validate && !git_object__is_valid(repo, parent, GIT_OBJ_COMMIT)) {
if (validate && !git_object__is_valid(repo, parent, GIT_OBJECT_COMMIT)) {
error = -1;
goto on_error;
}
......@@ -164,7 +164,7 @@ static int git_commit__create_internal(
if (git_odb__freshen(odb, tree) < 0)
goto cleanup;
if (git_odb_write(id, odb, buf.ptr, buf.size, GIT_OBJ_COMMIT) < 0)
if (git_odb_write(id, odb, buf.ptr, buf.size, GIT_OBJECT_COMMIT) < 0)
goto cleanup;
......@@ -730,7 +730,7 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
if ((error = git_odb_read(&obj, odb, commit_id)) < 0)
return error;
if (obj->cached.type != GIT_OBJ_COMMIT) {
if (obj->cached.type != GIT_OBJECT_COMMIT) {
giterr_set(GITERR_INVALID, "the requested type does not match the type in ODB");
error = GIT_ENOTFOUND;
goto cleanup;
......@@ -890,7 +890,7 @@ int git_commit_create_with_signature(
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0)
goto cleanup;
if ((error = git_odb_write(out, odb, commit.ptr, commit.size, GIT_OBJ_COMMIT)) < 0)
if ((error = git_odb_write(out, odb, commit.ptr, commit.size, GIT_OBJECT_COMMIT)) < 0)
goto cleanup;
cleanup:
......
......@@ -192,7 +192,7 @@ int git_commit_list_parse(git_revwalk *walk, git_commit_list_node *commit)
if ((error = git_odb_read(&obj, walk->odb, &commit->oid)) < 0)
return error;
if (obj->cached.type != GIT_OBJ_COMMIT) {
if (obj->cached.type != GIT_OBJECT_COMMIT) {
giterr_set(GITERR_INVALID, "object is no commit object");
error = -1;
} else
......
......@@ -151,7 +151,7 @@ static int retrieve_peeled_tag_or_object_oid(
if ((error = git_reference_lookup_resolved(&ref, repo, refname, -1)) < 0)
return error;
if ((error = git_reference_peel(&peeled, ref, GIT_OBJ_ANY)) < 0)
if ((error = git_reference_peel(&peeled, ref, GIT_OBJECT_ANY)) < 0)
goto cleanup;
git_oid_cpy(ref_target_out, git_reference_target(ref));
......@@ -392,7 +392,7 @@ static int find_unique_abbrev_size(
/* If we didn't find any shorter prefix, we have to do the whole thing */
*out = GIT_OID_HEXSZ;
return 0;
}
......@@ -563,14 +563,14 @@ static int describe(
goto cleanup;
}
if (unannotated_cnt) {
error = describe_not_found(git_commit_id(commit),
error = describe_not_found(git_commit_id(commit),
"cannot describe - "
"no annotated tags can describe '%s'; "
"however, there were unannotated tags.");
goto cleanup;
}
else {
error = describe_not_found(git_commit_id(commit),
error = describe_not_found(git_commit_id(commit),
"cannot describe - "
"no tags can describe '%s'.");
goto cleanup;
......@@ -686,7 +686,7 @@ int git_describe_commit(
/** TODO: contains to be implemented */
if ((error = git_object_peel((git_object **)(&commit), committish, GIT_OBJ_COMMIT)) < 0)
if ((error = git_object_peel((git_object **)(&commit), committish, GIT_OBJECT_COMMIT)) < 0)
goto cleanup;
if ((error = git_reference_foreach_name(
......@@ -738,7 +738,7 @@ int git_describe_workdir(
if ((error = git_reference_name_to_id(&current_id, repo, GIT_HEAD_FILE)) < 0)
return error;
if ((error = git_object_lookup(&commit, repo, &current_id, GIT_OBJ_COMMIT)) < 0)
if ((error = git_object_lookup(&commit, repo, &current_id, GIT_OBJECT_COMMIT)) < 0)
return error;
/* The first step is to perform a describe of HEAD, so we can leverage this */
......
......@@ -161,7 +161,7 @@ int git_diff_file_content__init_from_src(
fc->flags |= GIT_DIFF_FLAG__FREE_BLOB;
} else {
fc->file->size = src->buflen;
git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJ_BLOB);
git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJECT_BLOB);
fc->file->id_abbrev = GIT_OID_HEXSZ;
fc->map.len = src->buflen;
......@@ -251,7 +251,7 @@ static int diff_file_content_load_blob(
if (odb_obj != NULL) {
error = git_object__from_odb_object(
(git_object **)&fc->blob, fc->repo, odb_obj, GIT_OBJ_BLOB);
(git_object **)&fc->blob, fc->repo, odb_obj, GIT_OBJECT_BLOB);
git_odb_object_free(odb_obj);
} else {
error = git_blob_lookup(
......@@ -402,7 +402,7 @@ static int diff_file_content_load_workdir(
/* once data is loaded, update OID if we didn't have it previously */
if (!error && (fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0) {
error = git_odb_hash(
&fc->file->id, fc->map.data, fc->map.len, GIT_OBJ_BLOB);
&fc->file->id, fc->map.data, fc->map.len, GIT_OBJECT_BLOB);
fc->file->flags |= GIT_DIFF_FLAG_VALID_ID;
}
......
......@@ -138,7 +138,7 @@ static int diff_delta__from_one(
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_REVERSE))
has_old = !has_old;
if ((entry->flags & GIT_IDXENTRY_VALID) != 0)
if ((entry->flags & GIT_INDEX_ENTRY_VALID) != 0)
return 0;
if (status == GIT_DELTA_IGNORED &&
......@@ -640,7 +640,7 @@ int git_diff__oid_for_entry(
error = fd;
else {
error = git_odb__hashfd_filtered(
out, fd, (size_t)entry.file_size, GIT_OBJ_BLOB, fl);
out, fd, (size_t)entry.file_size, GIT_OBJECT_BLOB, fl);
p_close(fd);
diff->base.perf.oid_calculations++;
}
......@@ -764,11 +764,11 @@ static int maybe_modified(
status = GIT_DELTA_CONFLICTED;
/* support "assume unchanged" (poorly, b/c we still stat everything) */
} else if ((oitem->flags & GIT_IDXENTRY_VALID) != 0) {
} else if ((oitem->flags & GIT_INDEX_ENTRY_VALID) != 0) {
status = GIT_DELTA_UNMODIFIED;
/* support "skip worktree" index bit */
} else if ((oitem->flags_extended & GIT_IDXENTRY_SKIP_WORKTREE) != 0) {
} else if ((oitem->flags_extended & GIT_INDEX_ENTRY_SKIP_WORKTREE) != 0) {
status = GIT_DELTA_UNMODIFIED;
/* if basic type of file changed, then split into delete and add */
......
......@@ -109,7 +109,7 @@ GIT_INLINE(int) git_diff_file__resolve_zero_size(
int error;
git_odb *odb;
size_t len;
git_otype type;
git_object_t type;
if ((error = git_repository_odb(&odb, repo)) < 0)
return error;
......
......@@ -496,7 +496,7 @@ static int similarity_sig(
if (info->odb_obj != NULL)
error = git_object__from_odb_object(
(git_object **)&info->blob, info->repo,
info->odb_obj, GIT_OBJ_BLOB);
info->odb_obj, GIT_OBJECT_BLOB);
else
error = git_blob_lookup(&info->blob, info->repo, &file->id);
......
......@@ -23,11 +23,11 @@ static kh_inline khint_t idxentry_hash(const git_index_entry *e)
const char *s = e->path;
khint_t h = (khint_t)git__tolower(*s);
if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)git__tolower(*s);
return h + GIT_IDXENTRY_STAGE(e);
return h + GIT_INDEX_ENTRY_STAGE(e);
}
#define idxentry_equal(a, b) (GIT_IDXENTRY_STAGE(a) == GIT_IDXENTRY_STAGE(b) && strcmp(a->path, b->path) == 0)
#define idxentry_icase_equal(a, b) (GIT_IDXENTRY_STAGE(a) == GIT_IDXENTRY_STAGE(b) && strcasecmp(a->path, b->path) == 0)
#define idxentry_equal(a, b) (GIT_INDEX_ENTRY_STAGE(a) == GIT_INDEX_ENTRY_STAGE(b) && strcmp(a->path, b->path) == 0)
#define idxentry_icase_equal(a, b) (GIT_INDEX_ENTRY_STAGE(a) == GIT_INDEX_ENTRY_STAGE(b) && strcasecmp(a->path, b->path) == 0)
__KHASH_IMPL(idx, static kh_inline, const git_index_entry *, git_index_entry *, 1, idxentry_hash, idxentry_equal)
__KHASH_IMPL(idxicase, static kh_inline, const git_index_entry *, git_index_entry *, 1, idxentry_hash, idxentry_icase_equal)
......
......@@ -48,7 +48,7 @@ struct git_indexer {
unsigned int mode;
git_off_t off;
git_off_t entry_start;
git_otype entry_type;
git_object_t entry_type;
git_buf entry_data;
git_packfile_stream stream;
size_t nr_objects;
......@@ -213,7 +213,7 @@ static int store_delta(git_indexer *idx)
return 0;
}
static int hash_header(git_hash_ctx *ctx, git_off_t len, git_otype type)
static int hash_header(git_hash_ctx *ctx, git_off_t len, git_object_t type)
{
char buffer[64];
size_t hdrlen;
......@@ -249,13 +249,13 @@ static int hash_object_stream(git_indexer*idx, git_packfile_stream *stream)
}
/* In order to create the packfile stream, we need to skip over the delta base description */
static int advance_delta_offset(git_indexer *idx, git_otype type)
static int advance_delta_offset(git_indexer *idx, git_object_t type)
{
git_mwindow *w = NULL;
assert(type == GIT_OBJ_REF_DELTA || type == GIT_OBJ_OFS_DELTA);
assert(type == GIT_OBJECT_REF_DELTA || type == GIT_OBJECT_OFS_DELTA);
if (type == GIT_OBJ_REF_DELTA) {
if (type == GIT_OBJECT_REF_DELTA) {
idx->off += GIT_OID_RAWSZ;
} else {
git_off_t base_off = get_delta_base(idx->pack, &w, &idx->off, type, idx->entry_start);
......@@ -332,10 +332,10 @@ static int check_object_connectivity(git_indexer *idx, const git_rawobj *obj)
size_t keyidx;
int error;
if (obj->type != GIT_OBJ_BLOB &&
obj->type != GIT_OBJ_TREE &&
obj->type != GIT_OBJ_COMMIT &&
obj->type != GIT_OBJ_TAG)
if (obj->type != GIT_OBJECT_BLOB &&
obj->type != GIT_OBJECT_TREE &&
obj->type != GIT_OBJECT_COMMIT &&
obj->type != GIT_OBJECT_TAG)
return 0;
if ((error = git_object__from_raw(&object, obj->data, obj->len, obj->type)) < 0)
......@@ -356,7 +356,7 @@ static int check_object_connectivity(git_indexer *idx, const git_rawobj *obj)
return 0;
switch (obj->type) {
case GIT_OBJ_TREE:
case GIT_OBJECT_TREE:
{
git_tree *tree = (git_tree *) object;
git_tree_entry *entry;
......@@ -367,7 +367,7 @@ static int check_object_connectivity(git_indexer *idx, const git_rawobj *obj)
break;
}
case GIT_OBJ_COMMIT:
case GIT_OBJECT_COMMIT:
{
git_commit *commit = (git_commit *) object;
git_oid *parent_oid;
......@@ -380,7 +380,7 @@ static int check_object_connectivity(git_indexer *idx, const git_rawobj *obj)
break;
}
case GIT_OBJ_TAG:
case GIT_OBJECT_TAG:
{
git_tag *tag = (git_tag *) object;
......@@ -388,7 +388,7 @@ static int check_object_connectivity(git_indexer *idx, const git_rawobj *obj)
break;
}
case GIT_OBJ_BLOB:
case GIT_OBJECT_BLOB:
default:
break;
}
......@@ -661,7 +661,7 @@ static int read_stream_object(git_indexer *idx, git_transfer_progress *stats)
git_packfile_stream *stream = &idx->stream;
git_off_t entry_start = idx->off;
size_t entry_size;
git_otype type;
git_object_t type;
git_mwindow *w = NULL;
int error;
......@@ -682,7 +682,7 @@ static int read_stream_object(git_indexer *idx, git_transfer_progress *stats)
git_hash_init(&idx->hash_ctx);
git_buf_clear(&idx->entry_data);
if (type == GIT_OBJ_REF_DELTA || type == GIT_OBJ_OFS_DELTA) {
if (type == GIT_OBJECT_REF_DELTA || type == GIT_OBJECT_OFS_DELTA) {
error = advance_delta_offset(idx, type);
if (error == GIT_EBUFS) {
idx->off = entry_start;
......@@ -935,7 +935,7 @@ static int fix_thin_pack(git_indexer *idx, git_transfer_progress *stats)
unsigned int i;
struct delta_info *delta;
size_t size;
git_otype type;
git_object_t type;
git_mwindow *w = NULL;
git_off_t curpos = 0;
unsigned char *base_info;
......@@ -959,7 +959,7 @@ static int fix_thin_pack(git_indexer *idx, git_transfer_progress *stats)
if (error < 0)
return error;
if (type == GIT_OBJ_REF_DELTA) {
if (type == GIT_OBJECT_REF_DELTA) {
found_ref_delta = 1;
break;
}
......
......@@ -1272,10 +1272,10 @@ static int filesystem_iterator_entry_hash(
if (iter->base.type == GIT_ITERATOR_TYPE_WORKDIR)
return git_repository_hashfile(&entry->id,
iter->base.repo, entry->path, GIT_OBJ_BLOB, NULL);
iter->base.repo, entry->path, GIT_OBJECT_BLOB, NULL);
if (!(error = git_buf_joinpath(&fullpath, iter->root, entry->path)))
error = git_odb_hashfile(&entry->id, fullpath.ptr, GIT_OBJ_BLOB);
error = git_odb_hashfile(&entry->id, fullpath.ptr, GIT_OBJECT_BLOB);
git_buf_dispose(&fullpath);
return error;
......
......@@ -296,7 +296,7 @@ static int mailmap_add_blob(
if (error < 0)
goto cleanup;
error = git_object_peel((git_object **)&blob, object, GIT_OBJ_BLOB);
error = git_object_peel((git_object **)&blob, object, GIT_OBJECT_BLOB);
if (error < 0)
goto cleanup;
......
......@@ -859,7 +859,7 @@ static int merge_conflict_invoke_driver(
if ((error = driver->apply(driver, &path, &mode, &buf, name, src)) < 0 ||
(error = git_repository_odb(&odb, src->repo)) < 0 ||
(error = git_odb_write(&oid, odb, buf.ptr, buf.size, GIT_OBJ_BLOB)) < 0)
(error = git_odb_write(&oid, odb, buf.ptr, buf.size, GIT_OBJECT_BLOB)) < 0)
goto done;
result = git_pool_mallocz(&diff_list->pool, sizeof(git_index_entry));
......@@ -1084,7 +1084,7 @@ static int index_entry_similarity_inexact(
}
/* Tracks deletes by oid for merge_diff_mark_similarity_exact(). This is a
* non-shrinking queue where next_pos is the next position to dequeue.
* non-shrinking queue where next_pos is the next position to dequeue.
*/
typedef struct {
git_array_t(size_t) arr;
......@@ -1143,7 +1143,7 @@ static int deletes_by_oid_dequeue(size_t *idx, git_oidmap *map, const git_oid *i
return GIT_ENOTFOUND;
queue = git_oidmap_value_at(map, pos);
if (queue->next_pos == 0) {
*idx = queue->first_entry;
} else {
......
......@@ -31,38 +31,38 @@ int git_object__from_raw(
git_object **object_out,
const char *data,
size_t size,
git_otype type);
git_object_t type);
int git_object__from_odb_object(
git_object **object_out,
git_repository *repo,
git_odb_object *odb_obj,
git_otype type);
git_object_t type);
int git_object__resolve_to_type(git_object **obj, git_otype type);
int git_object__resolve_to_type(git_object **obj, git_object_t type);
git_otype git_object_stringn2type(const char *str, size_t len);
git_object_t git_object_stringn2type(const char *str, size_t len);
int git_oid__parse(git_oid *oid, const char **buffer_out, const char *buffer_end, const char *header);
void git_oid__writebuf(git_buf *buf, const char *header, const git_oid *oid);
bool git_object__is_valid(
git_repository *repo, const git_oid *id, git_otype expected_type);
git_repository *repo, const git_oid *id, git_object_t expected_type);
GIT_INLINE(git_otype) git_object__type_from_filemode(git_filemode_t mode)
GIT_INLINE(git_object_t) git_object__type_from_filemode(git_filemode_t mode)
{
switch (mode) {
case GIT_FILEMODE_TREE:
return GIT_OBJ_TREE;
return GIT_OBJECT_TREE;
case GIT_FILEMODE_COMMIT:
return GIT_OBJ_COMMIT;
return GIT_OBJECT_COMMIT;
case GIT_FILEMODE_BLOB:
case GIT_FILEMODE_BLOB_EXECUTABLE:
case GIT_FILEMODE_LINK:
return GIT_OBJ_BLOB;
return GIT_OBJECT_BLOB;
default:
return GIT_OBJ_BAD;
return GIT_OBJECT_BAD;
}
}
......
......@@ -20,12 +20,12 @@
*/
int git_commit_lookup(git_commit **out, git_repository *repo, const git_oid *id)
{
return git_object_lookup((git_object **)out, repo, id, GIT_OBJ_COMMIT);
return git_object_lookup((git_object **)out, repo, id, GIT_OBJECT_COMMIT);
}
int git_commit_lookup_prefix(git_commit **out, git_repository *repo, const git_oid *id, size_t len)
{
return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJ_COMMIT);
return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJECT_COMMIT);
}
void git_commit_free(git_commit *obj)
......@@ -53,12 +53,12 @@ int git_commit_dup(git_commit **out, git_commit *obj)
*/
int git_tree_lookup(git_tree **out, git_repository *repo, const git_oid *id)
{
return git_object_lookup((git_object **)out, repo, id, GIT_OBJ_TREE);
return git_object_lookup((git_object **)out, repo, id, GIT_OBJECT_TREE);
}
int git_tree_lookup_prefix(git_tree **out, git_repository *repo, const git_oid *id, size_t len)
{
return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJ_TREE);
return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJECT_TREE);
}
void git_tree_free(git_tree *obj)
......@@ -86,12 +86,12 @@ int git_tree_dup(git_tree **out, git_tree *obj)
*/
int git_tag_lookup(git_tag **out, git_repository *repo, const git_oid *id)
{
return git_object_lookup((git_object **)out, repo, id, GIT_OBJ_TAG);
return git_object_lookup((git_object **)out, repo, id, GIT_OBJECT_TAG);
}
int git_tag_lookup_prefix(git_tag **out, git_repository *repo, const git_oid *id, size_t len)
{
return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJ_TAG);
return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJECT_TAG);
}
void git_tag_free(git_tag *obj)
......@@ -119,12 +119,12 @@ int git_tag_dup(git_tag **out, git_tag *obj)
*/
int git_blob_lookup(git_blob **out, git_repository *repo, const git_oid *id)
{
return git_object_lookup((git_object **)out, repo, id, GIT_OBJ_BLOB);
return git_object_lookup((git_object **)out, repo, id, GIT_OBJECT_BLOB);
}
int git_blob_lookup_prefix(git_blob **out, git_repository *repo, const git_oid *id, size_t len)
{
return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJ_BLOB);
return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJECT_BLOB);
}
void git_blob_free(git_blob *obj)
......
......@@ -51,28 +51,28 @@ static git_cache *odb_cache(git_odb *odb)
return &odb->own_cache;
}
static int odb_otype_fast(git_otype *type_p, git_odb *db, const git_oid *id);
static int odb_otype_fast(git_object_t *type_p, git_odb *db, const git_oid *id);
static int load_alternates(git_odb *odb, const char *objects_dir, int alternate_depth);
static int error_null_oid(int error, const char *message);
static git_otype odb_hardcoded_type(const git_oid *id)
static git_object_t odb_hardcoded_type(const git_oid *id)
{
static git_oid empty_tree = {{ 0x4b, 0x82, 0x5d, 0xc6, 0x42, 0xcb, 0x6e, 0xb9, 0xa0, 0x60,
0xe5, 0x4b, 0xf8, 0xd6, 0x92, 0x88, 0xfb, 0xee, 0x49, 0x04 }};
if (!git_oid_cmp(id, &empty_tree))
return GIT_OBJ_TREE;
return GIT_OBJECT_TREE;
return GIT_OBJ_BAD;
return GIT_OBJECT_BAD;
}
static int odb_read_hardcoded(bool *found, git_rawobj *raw, const git_oid *id)
{
git_otype type;
git_object_t type;
*found = false;
if ((type = odb_hardcoded_type(id)) == GIT_OBJ_BAD)
if ((type = odb_hardcoded_type(id)) == GIT_OBJECT_BAD)
return 0;
raw->type = type;
......@@ -89,7 +89,7 @@ int git_odb__format_object_header(
char *hdr,
size_t hdr_size,
git_off_t obj_len,
git_otype obj_type)
git_object_t obj_type)
{
const char *type_str = git_object_type2string(obj_type);
int hdr_max = (hdr_size > INT_MAX-2) ? (INT_MAX-2) : (int)hdr_size;
......@@ -175,7 +175,7 @@ size_t git_odb_object_size(git_odb_object *object)
return object->cached.size;
}
git_otype git_odb_object_type(git_odb_object *object)
git_object_t git_odb_object_type(git_odb_object *object)
{
return object->cached.type;
}
......@@ -195,7 +195,7 @@ void git_odb_object_free(git_odb_object *object)
git_cached_obj_decref(object);
}
int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type)
int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_object_t type)
{
size_t hdr_len;
char hdr[64], buffer[FILEIO_BUFSIZE];
......@@ -243,7 +243,7 @@ done:
}
int git_odb__hashfd_filtered(
git_oid *out, git_file fd, size_t size, git_otype type, git_filter_list *fl)
git_oid *out, git_file fd, size_t size, git_object_t type, git_filter_list *fl)
{
int error;
git_buf raw = GIT_BUF_INIT;
......@@ -304,20 +304,20 @@ int git_odb__hashlink(git_oid *out, const char *path)
return -1;
}
result = git_odb_hash(out, link_data, size, GIT_OBJ_BLOB);
result = git_odb_hash(out, link_data, size, GIT_OBJECT_BLOB);
git__free(link_data);
} else {
int fd = git_futils_open_ro(path);
if (fd < 0)
return -1;
result = git_odb__hashfd(out, fd, size, GIT_OBJ_BLOB);
result = git_odb__hashfd(out, fd, size, GIT_OBJECT_BLOB);
p_close(fd);
}
return result;
}
int git_odb_hashfile(git_oid *out, const char *path, git_otype type)
int git_odb_hashfile(git_oid *out, const char *path, git_object_t type)
{
git_off_t size;
int result, fd = git_futils_open_ro(path);
......@@ -335,7 +335,7 @@ int git_odb_hashfile(git_oid *out, const char *path, git_otype type)
return result;
}
int git_odb_hash(git_oid *id, const void *data, size_t len, git_otype type)
int git_odb_hash(git_oid *id, const void *data, size_t len, git_object_t type)
{
git_rawobj raw;
......@@ -356,7 +356,7 @@ typedef struct {
git_odb_stream stream;
char *buffer;
size_t size, written;
git_otype type;
git_object_t type;
} fake_wstream;
static int fake_wstream__fwrite(git_odb_stream *_stream, const git_oid *oid)
......@@ -384,7 +384,7 @@ static void fake_wstream__free(git_odb_stream *_stream)
git__free(stream);
}
static int init_fake_wstream(git_odb_stream **stream_p, git_odb_backend *backend, git_off_t size, git_otype type)
static int init_fake_wstream(git_odb_stream **stream_p, git_odb_backend *backend, git_off_t size, git_object_t type)
{
fake_wstream *stream;
......@@ -871,7 +871,7 @@ int git_odb_expand_ids(
int error = GIT_EAMBIGUOUS;
if (!query->type)
query->type = GIT_OBJ_ANY;
query->type = GIT_OBJECT_ANY;
/* if we have a short OID, expand it first */
if (query->length >= GIT_OID_MINPREFIXLEN && query->length < GIT_OID_HEXSZ) {
......@@ -889,11 +889,11 @@ int git_odb_expand_ids(
* or because the user passed a full OID. Ensure its type is right.
*/
if (query->length >= GIT_OID_HEXSZ) {
git_otype actual_type;
git_object_t actual_type;
error = odb_otype_fast(&actual_type, db, &query->id);
if (!error) {
if (query->type != GIT_OBJ_ANY && query->type != actual_type)
if (query->type != GIT_OBJECT_ANY && query->type != actual_type)
error = GIT_ENOTFOUND;
else
query->type = actual_type;
......@@ -923,7 +923,7 @@ int git_odb_expand_ids(
return 0;
}
int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id)
int git_odb_read_header(size_t *len_p, git_object_t *type_p, git_odb *db, const git_oid *id)
{
int error;
git_odb_object *object;
......@@ -937,15 +937,15 @@ int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git
}
static int odb_read_header_1(
size_t *len_p, git_otype *type_p, git_odb *db,
size_t *len_p, git_object_t *type_p, git_odb *db,
const git_oid *id, bool only_refreshed)
{
size_t i;
git_otype ht;
git_object_t ht;
bool passthrough = false;
int error;
if (!only_refreshed && (ht = odb_hardcoded_type(id)) != GIT_OBJ_BAD) {
if (!only_refreshed && (ht = odb_hardcoded_type(id)) != GIT_OBJECT_BAD) {
*type_p = ht;
*len_p = 0;
return 0;
......@@ -980,7 +980,7 @@ static int odb_read_header_1(
}
int git_odb__read_header_or_object(
git_odb_object **out, size_t *len_p, git_otype *type_p,
git_odb_object **out, size_t *len_p, git_object_t *type_p,
git_odb *db, const git_oid *id)
{
int error = GIT_ENOTFOUND;
......@@ -1113,7 +1113,7 @@ int git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id)
return error;
}
static int odb_otype_fast(git_otype *type_p, git_odb *db, const git_oid *id)
static int odb_otype_fast(git_object_t *type_p, git_odb *db, const git_oid *id)
{
git_odb_object *object;
size_t _unused;
......@@ -1268,7 +1268,7 @@ int git_odb_foreach(git_odb *db, git_odb_foreach_cb cb, void *payload)
}
int git_odb_write(
git_oid *oid, git_odb *db, const void *data, size_t len, git_otype type)
git_oid *oid, git_odb *db, const void *data, size_t len, git_object_t type)
{
size_t i;
int error = GIT_ERROR;
......@@ -1313,7 +1313,7 @@ int git_odb_write(
return error;
}
static int hash_header(git_hash_ctx *ctx, git_off_t size, git_otype type)
static int hash_header(git_hash_ctx *ctx, git_off_t size, git_object_t type)
{
char header[64];
size_t hdrlen;
......@@ -1327,7 +1327,7 @@ static int hash_header(git_hash_ctx *ctx, git_off_t size, git_otype type)
}
int git_odb_open_wstream(
git_odb_stream **stream, git_odb *db, git_off_t size, git_otype type)
git_odb_stream **stream, git_odb *db, git_off_t size, git_object_t type)
{
size_t i, writes = 0;
int error = GIT_ERROR;
......@@ -1436,7 +1436,7 @@ void git_odb_stream_free(git_odb_stream *stream)
int git_odb_open_rstream(
git_odb_stream **stream,
size_t *len,
git_otype *type,
git_object_t *type,
git_odb *db,
const git_oid *oid)
{
......
......@@ -28,7 +28,7 @@ extern bool git_odb__strict_hash_verification;
typedef struct {
void *data; /**< Raw, decompressed object data. */
size_t len; /**< Total number of bytes in data. */
git_otype type; /**< Type of this object. */
git_object_t type; /**< Type of this object. */
} git_rawobj;
/* EXPORT */
......@@ -70,7 +70,7 @@ int git_odb__hashobj(git_oid *id, git_rawobj *obj);
/*
* Format the object header such as it would appear in the on-disk object
*/
int git_odb__format_object_header(size_t *out_len, char *hdr, size_t hdr_size, git_off_t obj_len, git_otype obj_type);
int git_odb__format_object_header(size_t *out_len, char *hdr, size_t hdr_size, git_off_t obj_len, git_object_t obj_type);
/*
* Hash an open file descriptor.
* This is a performance call when the contents of a fd need to be hashed,
......@@ -81,22 +81,22 @@ int git_odb__format_object_header(size_t *out_len, char *hdr, size_t hdr_size, g
* The fd is never closed, not even on error. It must be opened and closed
* by the caller
*/
int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type);
int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_object_t type);
/*
* Hash an open file descriptor applying an array of filters
* Acts just like git_odb__hashfd with the addition of filters...
*/
int git_odb__hashfd_filtered(
git_oid *out, git_file fd, size_t len, git_otype type, git_filter_list *fl);
git_oid *out, git_file fd, size_t len, git_object_t type, git_filter_list *fl);
/*
* Hash a `path`, assuming it could be a POSIX symlink: if the path is a
* symlink, then the raw contents of the symlink will be hashed. Otherwise,
* this will fallback to `git_odb__hashfd`.
*
* The hash type for this call is always `GIT_OBJ_BLOB` because symlinks may
* only point to blobs.
* The hash type for this call is always `GIT_OBJIECT_BLOB` because
* symlinks may only point to blobs.
*/
int git_odb__hashlink(git_oid *out, const char *path);
......@@ -122,7 +122,7 @@ int git_odb__error_ambiguous(const char *message);
* not be read.
*/
int git_odb__read_header_or_object(
git_odb_object **out, size_t *len_p, git_otype *type_p,
git_odb_object **out, size_t *len_p, git_object_t *type_p,
git_odb *db, const git_oid *id);
/* freshen an entry in the object database */
......
......@@ -25,7 +25,7 @@
#define MAX_HEADER_LEN 64
typedef struct { /* object header data */
git_otype type; /* object type */
git_object_t type; /* object type */
size_t size; /* object size */
} obj_hdr;
......@@ -351,7 +351,7 @@ static int read_loose(git_rawobj *out, git_buf *loc)
out->data = NULL;
out->len = 0;
out->type = GIT_OBJ_BAD;
out->type = GIT_OBJECT_BAD;
if ((error = git_futils_readbuffer(&obj, loc->ptr)) < 0)
goto done;
......@@ -574,7 +574,7 @@ static int locate_object_short_oid(
*
***********************************************************/
static int loose_backend__read_header(size_t *len_p, git_otype *type_p, git_odb_backend *backend, const git_oid *oid)
static int loose_backend__read_header(size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid)
{
git_buf object_path = GIT_BUF_INIT;
git_rawobj raw;
......@@ -583,7 +583,7 @@ static int loose_backend__read_header(size_t *len_p, git_otype *type_p, git_odb_
assert(backend && oid);
raw.len = 0;
raw.type = GIT_OBJ_BAD;
raw.type = GIT_OBJECT_BAD;
if (locate_object(&object_path, (loose_backend *)backend, oid) < 0) {
error = git_odb__error_notfound("no matching loose object",
......@@ -598,7 +598,7 @@ static int loose_backend__read_header(size_t *len_p, git_otype *type_p, git_odb_
return error;
}
static int loose_backend__read(void **buffer_p, size_t *len_p, git_otype *type_p, git_odb_backend *backend, const git_oid *oid)
static int loose_backend__read(void **buffer_p, size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid)
{
git_buf object_path = GIT_BUF_INIT;
git_rawobj raw;
......@@ -624,7 +624,7 @@ static int loose_backend__read_prefix(
git_oid *out_oid,
void **buffer_p,
size_t *len_p,
git_otype *type_p,
git_object_t *type_p,
git_odb_backend *backend,
const git_oid *short_oid,
size_t len)
......@@ -819,7 +819,7 @@ static int filebuf_flags(loose_backend *backend)
return flags;
}
static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backend *_backend, git_off_t length, git_otype type)
static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backend *_backend, git_off_t length, git_object_t type)
{
loose_backend *backend;
loose_writestream *stream = NULL;
......@@ -973,7 +973,7 @@ static int loose_backend__readstream_standard(
static int loose_backend__readstream(
git_odb_stream **stream_out,
size_t *len_out,
git_otype *type_out,
git_object_t *type_out,
git_odb_backend *_backend,
const git_oid *oid)
{
......@@ -989,7 +989,7 @@ static int loose_backend__readstream(
backend = (loose_backend *)_backend;
*stream_out = NULL;
*len_out = 0;
*type_out = GIT_OBJ_BAD;
*type_out = GIT_OBJECT_BAD;
if (locate_object(&object_path, backend, oid) < 0) {
error = git_odb__error_notfound("no matching loose object",
......@@ -1039,7 +1039,7 @@ done:
return error;
}
static int loose_backend__write(git_odb_backend *_backend, const git_oid *oid, const void *data, size_t len, git_otype type)
static int loose_backend__write(git_odb_backend *_backend, const git_oid *oid, const void *data, size_t len, git_object_t type)
{
int error = 0;
git_buf final_path = GIT_BUF_INIT;
......
......@@ -23,7 +23,7 @@
struct memobject {
git_oid oid;
size_t len;
git_otype type;
git_object_t type;
char data[GIT_FLEX_ARRAY];
};
......@@ -33,10 +33,10 @@ struct memory_packer_db {
git_array_t(struct memobject *) commits;
};
static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void *data, size_t len, git_otype type)
static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void *data, size_t len, git_object_t type)
{
struct memory_packer_db *db = (struct memory_packer_db *)_backend;
struct memobject *obj = NULL;
struct memobject *obj = NULL;
size_t pos;
size_t alloc_len;
int rval;
......@@ -60,7 +60,7 @@ static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void
git_oidmap_set_key_at(db->objects, pos, &obj->oid);
git_oidmap_set_value_at(db->objects, pos, obj);
if (type == GIT_OBJ_COMMIT) {
if (type == GIT_OBJECT_COMMIT) {
struct memobject **store = git_array_alloc(db->commits);
GITERR_CHECK_ALLOC(store);
*store = obj;
......@@ -76,7 +76,7 @@ static int impl__exists(git_odb_backend *backend, const git_oid *oid)
return git_oidmap_exists(db->objects, oid);
}
static int impl__read(void **buffer_p, size_t *len_p, git_otype *type_p, git_odb_backend *backend, const git_oid *oid)
static int impl__read(void **buffer_p, size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid)
{
struct memory_packer_db *db = (struct memory_packer_db *)backend;
struct memobject *obj = NULL;
......@@ -97,7 +97,7 @@ static int impl__read(void **buffer_p, size_t *len_p, git_otype *type_p, git_odb
return 0;
}
static int impl__read_header(size_t *len_p, git_otype *type_p, git_odb_backend *backend, const git_oid *oid)
static int impl__read_header(size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid)
{
struct memory_packer_db *db = (struct memory_packer_db *)backend;
struct memobject *obj = NULL;
......
......@@ -353,7 +353,7 @@ static int pack_backend__refresh(git_odb_backend *backend_)
}
static int pack_backend__read_header(
size_t *len_p, git_otype *type_p,
size_t *len_p, git_object_t *type_p,
struct git_odb_backend *backend, const git_oid *oid)
{
struct git_pack_entry e;
......@@ -390,7 +390,7 @@ static int pack_backend__freshen(
}
static int pack_backend__read(
void **buffer_p, size_t *len_p, git_otype *type_p,
void **buffer_p, size_t *len_p, git_object_t *type_p,
git_odb_backend *backend, const git_oid *oid)
{
struct git_pack_entry e;
......@@ -412,7 +412,7 @@ static int pack_backend__read_prefix(
git_oid *out_oid,
void **buffer_p,
size_t *len_p,
git_otype *type_p,
git_object_t *type_p,
git_odb_backend *backend,
const git_oid *short_oid,
size_t len)
......
......@@ -322,7 +322,7 @@ static int write_object(
void *cb_data)
{
git_odb_object *obj = NULL;
git_otype type;
git_object_t type;
unsigned char hdr[10], *zbuf = NULL;
void *data = NULL;
size_t hdr_len, zbuf_len = COMPRESS_BUFLEN, data_len;
......@@ -340,7 +340,7 @@ static int write_object(
goto done;
data_len = po->delta_size;
type = GIT_OBJ_REF_DELTA;
type = GIT_OBJECT_REF_DELTA;
} else {
if ((error = git_odb_read(&obj, pb->odb, &po->id)) < 0)
goto done;
......@@ -357,7 +357,7 @@ static int write_object(
(error = git_hash_update(&pb->ctx, hdr, hdr_len)) < 0)
goto done;
if (type == GIT_OBJ_REF_DELTA) {
if (type == GIT_OBJECT_REF_DELTA) {
if ((error = write_cb(po->delta->id.id, GIT_OID_RAWSZ, cb_data)) < 0 ||
(error = git_hash_update(&pb->ctx, po->delta->id.id, GIT_OID_RAWSZ)) < 0)
goto done;
......@@ -594,8 +594,8 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
*/
for (i = last_untagged; i < pb->nr_objects; i++) {
git_pobject *po = pb->object_list + i;
if (po->type != GIT_OBJ_COMMIT &&
po->type != GIT_OBJ_TAG)
if (po->type != GIT_OBJECT_COMMIT &&
po->type != GIT_OBJECT_TAG)
continue;
add_to_write_order(wo, &wo_end, po);
}
......@@ -605,7 +605,7 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
*/
for (i = last_untagged; i < pb->nr_objects; i++) {
git_pobject *po = pb->object_list + i;
if (po->type != GIT_OBJ_TREE)
if (po->type != GIT_OBJECT_TREE)
continue;
add_to_write_order(wo, &wo_end, po);
}
......@@ -1434,7 +1434,7 @@ static int cb_tree_walk(
struct tree_walk_context *ctx = payload;
/* A commit inside a tree represents a submodule commit and should be skipped. */
if (git_tree_entry_type(entry) == GIT_OBJ_COMMIT)
if (git_tree_entry_type(entry) == GIT_OBJECT_COMMIT)
return 0;
if (!(error = git_buf_sets(&ctx->buf, root)) &&
......@@ -1482,20 +1482,20 @@ int git_packbuilder_insert_recur(git_packbuilder *pb, const git_oid *id, const c
assert(pb && id);
if ((error = git_object_lookup(&obj, pb->repo, id, GIT_OBJ_ANY)) < 0)
if ((error = git_object_lookup(&obj, pb->repo, id, GIT_OBJECT_ANY)) < 0)
return error;
switch (git_object_type(obj)) {
case GIT_OBJ_BLOB:
case GIT_OBJECT_BLOB:
error = git_packbuilder_insert(pb, id, name);
break;
case GIT_OBJ_TREE:
case GIT_OBJECT_TREE:
error = git_packbuilder_insert_tree(pb, id);
break;
case GIT_OBJ_COMMIT:
case GIT_OBJECT_COMMIT:
error = git_packbuilder_insert_commit(pb, id);
break;
case GIT_OBJ_TAG:
case GIT_OBJECT_TAG:
if ((error = git_packbuilder_insert(pb, id, name)) < 0)
goto cleanup;
error = git_packbuilder_insert_recur(pb, git_tag_target_id((git_tag *) obj), NULL);
......@@ -1592,11 +1592,11 @@ static int mark_tree_uninteresting(git_packbuilder *pb, const git_oid *id)
const git_tree_entry *entry = git_tree_entry_byindex(tree, i);
const git_oid *entry_id = git_tree_entry_id(entry);
switch (git_tree_entry_type(entry)) {
case GIT_OBJ_TREE:
case GIT_OBJECT_TREE:
if ((error = mark_tree_uninteresting(pb, entry_id)) < 0)
goto cleanup;
break;
case GIT_OBJ_BLOB:
case GIT_OBJECT_BLOB:
if ((error = mark_blob_uninteresting(pb, entry_id)) < 0)
goto cleanup;
break;
......@@ -1662,7 +1662,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
const git_tree_entry *entry = git_tree_entry_byindex(tree, i);
const git_oid *entry_id = git_tree_entry_id(entry);
switch (git_tree_entry_type(entry)) {
case GIT_OBJ_TREE:
case GIT_OBJECT_TREE:
if ((error = git_tree_lookup(&subtree, pb->repo, entry_id)) < 0)
return error;
......@@ -1673,7 +1673,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
return error;
break;
case GIT_OBJ_BLOB:
case GIT_OBJECT_BLOB:
if ((error = retrieve_object(&obj, pb, entry_id)) < 0)
return error;
if (obj->uninteresting)
......
......@@ -29,7 +29,7 @@
typedef struct git_pobject {
git_oid id;
git_otype type;
git_object_t type;
git_off_t offset;
size_t size;
......
......@@ -24,7 +24,7 @@ static int packfile_unpack_compressed(
git_mwindow **w_curs,
git_off_t *curpos,
size_t size,
git_otype type);
git_object_t type);
/* Can find the offset of an object given
* a prefix of an identifier.
......@@ -378,12 +378,12 @@ static unsigned char *pack_window_open(
* - each byte afterwards: low seven bits are size continuation,
* with the high bit being "size continues"
*/
size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_otype type)
size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_object_t type)
{
unsigned char *hdr_base;
unsigned char c;
assert(type >= GIT_OBJ_COMMIT && type <= GIT_OBJ_REF_DELTA);
assert(type >= GIT_OBJECT_COMMIT && type <= GIT_OBJECT_REF_DELTA);
/* TODO: add support for chunked objects; see git.git 6c0d19b1 */
......@@ -405,7 +405,7 @@ size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_otype ty
static int packfile_unpack_header1(
unsigned long *usedp,
size_t *sizep,
git_otype *type,
git_object_t *type,
const unsigned char *buf,
unsigned long len)
{
......@@ -441,7 +441,7 @@ static int packfile_unpack_header1(
int git_packfile_unpack_header(
size_t *size_p,
git_otype *type_p,
git_object_t *type_p,
git_mwindow_file *mwf,
git_mwindow **w_curs,
git_off_t *curpos)
......@@ -475,14 +475,14 @@ int git_packfile_unpack_header(
int git_packfile_resolve_header(
size_t *size_p,
git_otype *type_p,
git_object_t *type_p,
struct git_pack_file *p,
git_off_t offset)
{
git_mwindow *w_curs = NULL;
git_off_t curpos = offset;
size_t size;
git_otype type;
git_object_t type;
git_off_t base_offset;
int error;
......@@ -490,7 +490,7 @@ int git_packfile_resolve_header(
if (error < 0)
return error;
if (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
if (type == GIT_OBJECT_OFS_DELTA || type == GIT_OBJECT_REF_DELTA) {
size_t base_size;
git_packfile_stream stream;
......@@ -507,12 +507,12 @@ int git_packfile_resolve_header(
base_offset = 0;
}
while (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
while (type == GIT_OBJECT_OFS_DELTA || type == GIT_OBJECT_REF_DELTA) {
curpos = base_offset;
error = git_packfile_unpack_header(&size, &type, &p->mwf, &w_curs, &curpos);
if (error < 0)
return error;
if (type != GIT_OBJ_OFS_DELTA && type != GIT_OBJ_REF_DELTA)
if (type != GIT_OBJECT_OFS_DELTA && type != GIT_OBJECT_REF_DELTA)
break;
base_offset = get_delta_base(p, &w_curs, &curpos, type, base_offset);
git_mwindow_close(&w_curs);
......@@ -540,7 +540,7 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
git_off_t curpos = obj_offset, base_offset;
int error = 0, use_heap = 0;
size_t size, elem_pos;
git_otype type;
git_object_t type;
elem_pos = 0;
while (true) {
......@@ -586,7 +586,7 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
elem->type = type;
elem->base_key = obj_offset;
if (type != GIT_OBJ_OFS_DELTA && type != GIT_OBJ_REF_DELTA)
if (type != GIT_OBJECT_OFS_DELTA && type != GIT_OBJECT_REF_DELTA)
break;
base_offset = get_delta_base(p, &w_curs, &curpos, type, obj_offset);
......@@ -609,7 +609,7 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
elem_pos++;
}
*stack_sz = elem_pos + 1;
*chain_out = chain;
return error;
......@@ -632,7 +632,7 @@ int git_packfile_unpack(
git_pack_cache_entry *cached = NULL;
struct pack_chain_elem small_stack[SMALL_STACK_SIZE];
size_t stack_size = 0, elem_pos, alloclen;
git_otype base_type;
git_object_t base_type;
/*
* TODO: optionally check the CRC on the packfile
......@@ -644,7 +644,7 @@ int git_packfile_unpack(
obj->data = NULL;
obj->len = 0;
obj->type = GIT_OBJ_BAD;
obj->type = GIT_OBJECT_BAD;
/* let's point to the right stack */
stack = chain.ptr ? chain.ptr : small_stack;
......@@ -660,10 +660,10 @@ int git_packfile_unpack(
}
switch (base_type) {
case GIT_OBJ_COMMIT:
case GIT_OBJ_TREE:
case GIT_OBJ_BLOB:
case GIT_OBJ_TAG:
case GIT_OBJECT_COMMIT:
case GIT_OBJECT_TREE:
case GIT_OBJECT_BLOB:
case GIT_OBJECT_TAG:
if (!cached) {
curpos = elem->offset;
error = packfile_unpack_compressed(obj, p, &w_curs, &curpos, elem->size, elem->type);
......@@ -673,8 +673,8 @@ int git_packfile_unpack(
if (error < 0)
goto cleanup;
break;
case GIT_OBJ_OFS_DELTA:
case GIT_OBJ_REF_DELTA:
case GIT_OBJECT_OFS_DELTA:
case GIT_OBJECT_REF_DELTA:
error = packfile_error("dependency chain ends in a delta");
goto cleanup;
default:
......@@ -726,7 +726,7 @@ int git_packfile_unpack(
base = *obj;
obj->data = NULL;
obj->len = 0;
obj->type = GIT_OBJ_BAD;
obj->type = GIT_OBJECT_BAD;
error = git_delta_apply(&obj->data, &obj->len, base.data, base.len, delta.data, delta.len);
obj->type = base_type;
......@@ -851,7 +851,7 @@ static int packfile_unpack_compressed(
git_mwindow **w_curs,
git_off_t *curpos,
size_t size,
git_otype type)
git_object_t type)
{
size_t buf_size;
int st;
......@@ -916,7 +916,7 @@ git_off_t get_delta_base(
struct git_pack_file *p,
git_mwindow **w_curs,
git_off_t *curpos,
git_otype type,
git_object_t type,
git_off_t delta_obj_offset)
{
unsigned int left = 0;
......@@ -934,7 +934,7 @@ git_off_t get_delta_base(
* that is assured. An OFS_DELTA longer than the hash size
* is stupid, as then a REF_DELTA would be smaller to store.
*/
if (type == GIT_OBJ_OFS_DELTA) {
if (type == GIT_OBJECT_OFS_DELTA) {
unsigned used = 0;
unsigned char c = base_info[used++];
size_t unsigned_base_offset = c & 127;
......@@ -951,7 +951,7 @@ git_off_t get_delta_base(
return 0; /* out of bound */
base_offset = delta_obj_offset - unsigned_base_offset;
*curpos += used;
} else if (type == GIT_OBJ_REF_DELTA) {
} else if (type == GIT_OBJECT_REF_DELTA) {
/* If we have the cooperative cache, search in it first */
if (p->has_cache) {
git_oid oid;
......
......@@ -66,7 +66,7 @@ struct pack_chain_elem {
git_off_t base_key;
git_off_t offset;
size_t size;
git_otype type;
git_object_t type;
};
typedef git_array_t(struct pack_chain_elem) git_dependency_chain;
......@@ -123,20 +123,20 @@ typedef struct git_packfile_stream {
git_mwindow *mw;
} git_packfile_stream;
size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_otype type);
size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_object_t type);
int git_packfile__name(char **out, const char *path);
int git_packfile_unpack_header(
size_t *size_p,
git_otype *type_p,
git_object_t *type_p,
git_mwindow_file *mwf,
git_mwindow **w_curs,
git_off_t *curpos);
int git_packfile_resolve_header(
size_t *size_p,
git_otype *type_p,
git_object_t *type_p,
struct git_pack_file *p,
git_off_t offset);
......@@ -147,7 +147,7 @@ ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t
void git_packfile_stream_dispose(git_packfile_stream *obj);
git_off_t get_delta_base(struct git_pack_file *p, git_mwindow **w_curs,
git_off_t *curpos, git_otype type,
git_off_t *curpos, git_object_t type,
git_off_t delta_obj_offset);
void git_packfile_close(struct git_pack_file *p, bool unlink_packfile);
......
......@@ -242,10 +242,10 @@ static int enqueue_tag(git_object **out, git_push *push, git_oid *id)
git_object *obj = NULL, *target = NULL;
int error;
if ((error = git_object_lookup(&obj, push->repo, id, GIT_OBJ_TAG)) < 0)
if ((error = git_object_lookup(&obj, push->repo, id, GIT_OBJECT_TAG)) < 0)
return error;
while (git_object_type(obj) == GIT_OBJ_TAG) {
while (git_object_type(obj) == GIT_OBJECT_TAG) {
if ((error = git_packbuilder_insert(push->pb, git_object_id(obj), NULL)) < 0)
break;
......@@ -278,7 +278,7 @@ static int queue_objects(git_push *push)
git_revwalk_sorting(rw, GIT_SORT_TIME);
git_vector_foreach(&push->specs, i, spec) {
git_otype type;
git_object_t type;
size_t size;
if (git_oid_iszero(&spec->loid))
......@@ -294,13 +294,13 @@ static int queue_objects(git_push *push)
if (git_odb_read_header(&size, &type, push->repo->_odb, &spec->loid) < 0)
goto on_error;
if (type == GIT_OBJ_TAG) {
if (type == GIT_OBJECT_TAG) {
git_object *target;
if ((error = enqueue_tag(&target, push, &spec->loid)) < 0)
goto on_error;
if (git_object_type(target) == GIT_OBJ_COMMIT) {
if (git_object_type(target) == GIT_OBJECT_COMMIT) {
if (git_revwalk_push(rw, git_object_id(target)) < 0) {
git_object_free(target);
goto on_error;
......@@ -323,7 +323,7 @@ static int queue_objects(git_push *push)
continue;
if (!git_odb_exists(push->repo->_odb, &spec->roid)) {
giterr_set(GITERR_REFERENCE,
giterr_set(GITERR_REFERENCE,
"cannot push because a reference that you are trying to update on the remote contains commits that are not present locally.");
error = GIT_ENONFASTFORWARD;
goto on_error;
......
......@@ -119,7 +119,7 @@ static int workdir_reader_read(
goto done;
if (out_id || reader->index) {
if ((error = git_odb_hash(&id, out->ptr, out->size, GIT_OBJ_BLOB)) < 0)
if ((error = git_odb_hash(&id, out->ptr, out->size, GIT_OBJECT_BLOB)) < 0)
goto done;
}
......
......@@ -1014,7 +1014,7 @@ static int rebase_commit_merge(
if ((error = rebase_ensure_not_dirty(rebase->repo, false, true, GIT_EUNMERGED)) < 0 ||
(error = git_repository_head(&head, rebase->repo)) < 0 ||
(error = git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)) < 0 ||
(error = git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)) < 0 ||
(error = git_repository_index(&index, rebase->repo)) < 0 ||
(error = rebase_commit__create(&commit, rebase, index, head_commit,
author, committer, message_encoding, message)) < 0 ||
......@@ -1288,7 +1288,7 @@ static int return_to_orig_head(git_rebase *rebase)
rebase->orig_head_name)) == 0 &&
(error = git_repository_head(&terminal_ref, rebase->repo)) == 0 &&
(error = git_reference_peel((git_object **)&terminal_commit,
terminal_ref, GIT_OBJ_COMMIT)) == 0 &&
terminal_ref, GIT_OBJECT_COMMIT)) == 0 &&
(error = git_reference_create_matching(&branch_ref,
rebase->repo, rebase->orig_head_name,
git_commit_id(terminal_commit), 1,
......
......@@ -894,7 +894,7 @@ static int packed_find_peel(refdb_fs_backend *backend, struct packref *ref)
/*
* Find the tagged object in the repository
*/
if (git_object_lookup(&object, backend->repo, &ref->oid, GIT_OBJ_ANY) < 0)
if (git_object_lookup(&object, backend->repo, &ref->oid, GIT_OBJECT_ANY) < 0)
return -1;
/*
......@@ -902,7 +902,7 @@ static int packed_find_peel(refdb_fs_backend *backend, struct packref *ref)
* if the ref is actually a 'weak' ref, we don't need to resolve
* anything.
*/
if (git_object_type(object) == GIT_OBJ_TAG) {
if (git_object_type(object) == GIT_OBJECT_TAG) {
git_tag *tag = (git_tag *)object;
/*
......
......@@ -436,7 +436,7 @@ static int reference__create(
if (oid != NULL) {
assert(symbolic == NULL);
if (!git_object__is_valid(repo, oid, GIT_OBJ_ANY)) {
if (!git_object__is_valid(repo, oid, GIT_OBJECT_ANY)) {
giterr_set(GITERR_REFERENCE,
"target OID for the reference doesn't exist on the repository");
return -1;
......@@ -1348,7 +1348,7 @@ static int peel_error(int error, git_reference *ref, const char* msg)
int git_reference_peel(
git_object **peeled,
git_reference *ref,
git_otype target_type)
git_object_t target_type)
{
git_reference *resolved = NULL;
git_object *target = NULL;
......@@ -1369,12 +1369,12 @@ int git_reference_peel(
* to a commit. So we only want to use the peeled value
* if it is not zero and the target is not a tag.
*/
if (target_type != GIT_OBJ_TAG && !git_oid_iszero(&resolved->peel)) {
if (target_type != GIT_OBJECT_TAG && !git_oid_iszero(&resolved->peel)) {
error = git_object_lookup(&target,
git_reference_owner(ref), &resolved->peel, GIT_OBJ_ANY);
git_reference_owner(ref), &resolved->peel, GIT_OBJECT_ANY);
} else {
error = git_object_lookup(&target,
git_reference_owner(ref), &resolved->target.oid, GIT_OBJ_ANY);
git_reference_owner(ref), &resolved->target.oid, GIT_OBJECT_ANY);
}
if (error < 0) {
......@@ -1382,7 +1382,7 @@ int git_reference_peel(
goto cleanup;
}
if (target_type == GIT_OBJ_ANY && git_object_type(target) != GIT_OBJ_TAG)
if (target_type == GIT_OBJECT_ANY && git_object_type(target) != GIT_OBJECT_TAG)
error = git_object_dup(peeled, target);
else
error = git_object_peel(peeled, target, target_type);
......
......@@ -1186,7 +1186,8 @@ int git_repository_index__weakptr(git_index **out, git_repository *repo)
git_index_free(index);
}
error = git_index_set_caps(repo->_index, GIT_INDEXCAP_FROM_OWNER);
error = git_index_set_caps(repo->_index,
GIT_INDEX_CAPABILITY_FROM_OWNER);
}
git_buf_dispose(&index_path);
......@@ -2449,7 +2450,7 @@ int git_repository_head_tree(git_tree **tree, git_repository *repo)
if ((error = git_repository_head(&head, repo)) < 0)
return error;
if ((error = git_reference_peel(&obj, head, GIT_OBJ_TREE)) < 0)
if ((error = git_reference_peel(&obj, head, GIT_OBJECT_TREE)) < 0)
goto cleanup;
*tree = (git_tree *)obj;
......@@ -2523,7 +2524,7 @@ int git_repository_hashfile(
git_oid *out,
git_repository *repo,
const char *path,
git_otype type,
git_object_t type,
const char *as_path)
{
int error;
......@@ -2625,10 +2626,10 @@ static int detach(git_repository *repo, const git_oid *id, const char *new)
if ((error = git_reference_lookup(&current, repo, GIT_HEAD_FILE)) < 0)
return error;
if ((error = git_object_lookup(&object, repo, id, GIT_OBJ_ANY)) < 0)
if ((error = git_object_lookup(&object, repo, id, GIT_OBJECT_ANY)) < 0)
goto cleanup;
if ((error = git_object_peel(&peeled, object, GIT_OBJ_COMMIT)) < 0)
if ((error = git_object_peel(&peeled, object, GIT_OBJECT_COMMIT)) < 0)
goto cleanup;
if (new == NULL)
......@@ -2728,7 +2729,7 @@ int git_repository_detach_head(git_repository* repo)
if ((error = git_repository_head(&old_head, repo)) < 0)
goto cleanup;
if ((error = git_object_lookup(&object, repo, git_reference_target(old_head), GIT_OBJ_COMMIT)) < 0)
if ((error = git_object_lookup(&object, repo, git_reference_target(old_head), GIT_OBJECT_COMMIT)) < 0)
goto cleanup;
if ((error = checkout_message(&log_message, current, git_oid_tostr_s(git_object_id(object)))) < 0)
......
......@@ -47,7 +47,7 @@ int git_reset_default(
return -1;
}
if ((error = git_object_peel(&commit, target, GIT_OBJ_COMMIT)) < 0 ||
if ((error = git_object_peel(&commit, target, GIT_OBJECT_COMMIT)) < 0 ||
(error = git_commit_tree(&tree, (git_commit *)commit)) < 0)
goto cleanup;
}
......@@ -129,7 +129,7 @@ static int reset(
reset_type == GIT_RESET_MIXED ? "reset mixed" : "reset hard")) < 0)
return error;
if ((error = git_object_peel(&commit, target, GIT_OBJ_COMMIT)) < 0 ||
if ((error = git_object_peel(&commit, target, GIT_OBJECT_COMMIT)) < 0 ||
(error = git_repository_index(&index, repo)) < 0 ||
(error = git_commit_tree(&tree, (git_commit *)commit)) < 0)
goto cleanup;
......
......@@ -201,7 +201,7 @@ int git_revert(
(error = write_revert_head(repo, commit_oidstr)) < 0 ||
(error = write_merge_msg(repo, commit_oidstr, commit_msg)) < 0 ||
(error = git_repository_head(&our_ref, repo)) < 0 ||
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJ_COMMIT)) < 0 ||
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJECT_COMMIT)) < 0 ||
(error = git_revert_commit(&index, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
(error = git_merge__check_result(repo, index)) < 0 ||
(error = git_merge__append_conflicts_to_merge_msg(repo, index)) < 0 ||
......
......@@ -22,7 +22,7 @@ static int maybe_sha_or_abbrev(git_object** out, git_repository *repo, const cha
if (git_oid_fromstrn(&oid, spec, speclen) < 0)
return GIT_ENOTFOUND;
return git_object_lookup_prefix(out, repo, &oid, speclen, GIT_OBJ_ANY);
return git_object_lookup_prefix(out, repo, &oid, speclen, GIT_OBJECT_ANY);
}
static int maybe_sha(git_object** out, git_repository *repo, const char *spec)
......@@ -101,7 +101,7 @@ static int revparse_lookup_object(
if (!error) {
error = git_object_lookup(
object_out, repo, git_reference_target(ref), GIT_OBJ_ANY);
object_out, repo, git_reference_target(ref), GIT_OBJECT_ANY);
if (!error)
*reference_out = ref;
......@@ -269,14 +269,14 @@ static int retrieve_revobject_from_reflog(git_object **out, git_reference **base
}
if (position == 0) {
error = git_object_lookup(out, repo, git_reference_target(ref), GIT_OBJ_ANY);
error = git_object_lookup(out, repo, git_reference_target(ref), GIT_OBJECT_ANY);
goto cleanup;
}
if ((error = retrieve_oid_from_reflog(&oid, ref, position)) < 0)
goto cleanup;
error = git_object_lookup(out, repo, &oid, GIT_OBJ_ANY);
error = git_object_lookup(out, repo, &oid, GIT_OBJECT_ANY);
cleanup:
git_reference_free(ref);
......@@ -355,26 +355,26 @@ cleanup:
return error;
}
static git_otype parse_obj_type(const char *str)
static git_object_t parse_obj_type(const char *str)
{
if (!strcmp(str, "commit"))
return GIT_OBJ_COMMIT;
return GIT_OBJECT_COMMIT;
if (!strcmp(str, "tree"))
return GIT_OBJ_TREE;
return GIT_OBJECT_TREE;
if (!strcmp(str, "blob"))
return GIT_OBJ_BLOB;
return GIT_OBJECT_BLOB;
if (!strcmp(str, "tag"))
return GIT_OBJ_TAG;
return GIT_OBJECT_TAG;
return GIT_OBJ_BAD;
return GIT_OBJECT_BAD;
}
static int dereference_to_non_tag(git_object **out, git_object *obj)
{
if (git_object_type(obj) == GIT_OBJ_TAG)
if (git_object_type(obj) == GIT_OBJECT_TAG)
return git_tag_peel(out, (git_tag *)obj);
return git_object_dup(out, obj);
......@@ -385,7 +385,7 @@ static int handle_caret_parent_syntax(git_object **out, git_object *obj, int n)
git_object *temp_commit = NULL;
int error;
if ((error = git_object_peel(&temp_commit, obj, GIT_OBJ_COMMIT)) < 0)
if ((error = git_object_peel(&temp_commit, obj, GIT_OBJECT_COMMIT)) < 0)
return (error == GIT_EAMBIGUOUS || error == GIT_ENOTFOUND) ?
GIT_EINVALIDSPEC : error;
......@@ -405,7 +405,7 @@ static int handle_linear_syntax(git_object **out, git_object *obj, int n)
git_object *temp_commit = NULL;
int error;
if ((error = git_object_peel(&temp_commit, obj, GIT_OBJ_COMMIT)) < 0)
if ((error = git_object_peel(&temp_commit, obj, GIT_OBJECT_COMMIT)) < 0)
return (error == GIT_EAMBIGUOUS || error == GIT_ENOTFOUND) ?
GIT_EINVALIDSPEC : error;
......@@ -424,7 +424,7 @@ static int handle_colon_syntax(
int error = -1;
git_tree_entry *entry = NULL;
if ((error = git_object_peel(&tree, obj, GIT_OBJ_TREE)) < 0)
if ((error = git_object_peel(&tree, obj, GIT_OBJECT_TREE)) < 0)
return error == GIT_ENOTFOUND ? GIT_EINVALIDSPEC : error;
if (*path == '\0') {
......@@ -456,7 +456,7 @@ static int walk_and_search(git_object **out, git_revwalk *walk, regex_t *regex)
while (!(error = git_revwalk_next(&oid, walk))) {
error = git_object_lookup(&obj, git_revwalk_repository(walk), &oid, GIT_OBJ_COMMIT);
error = git_object_lookup(&obj, git_revwalk_repository(walk), &oid, GIT_OBJECT_COMMIT);
if ((error < 0) && (error != GIT_ENOTFOUND))
return -1;
......@@ -505,7 +505,7 @@ cleanup:
static int handle_caret_curly_syntax(git_object **out, git_object *obj, const char *curly_braces_content)
{
git_otype expected_type;
git_object_t expected_type;
if (*curly_braces_content == '\0')
return dereference_to_non_tag(out, obj);
......@@ -515,7 +515,7 @@ static int handle_caret_curly_syntax(git_object **out, git_object *obj, const ch
expected_type = parse_obj_type(curly_braces_content);
if (expected_type == GIT_OBJ_BAD)
if (expected_type == GIT_OBJECT_BAD)
return GIT_EINVALIDSPEC;
return git_object_peel(out, obj, expected_type);
......@@ -601,7 +601,7 @@ static int object_from_reference(git_object **object, git_reference *reference)
if (git_reference_resolve(&resolved, reference) < 0)
return -1;
error = git_object_lookup(object, reference->db->repo, git_reference_target(resolved), GIT_OBJ_ANY);
error = git_object_lookup(object, reference->db->repo, git_reference_target(resolved), GIT_OBJECT_ANY);
git_reference_free(resolved);
return error;
......
......@@ -50,10 +50,10 @@ static int push_commit(git_revwalk *walk, const git_oid *oid, int uninteresting,
git_commit_list_node *commit;
git_commit_list *list;
if ((error = git_object_lookup(&oobj, walk->repo, oid, GIT_OBJ_ANY)) < 0)
if ((error = git_object_lookup(&oobj, walk->repo, oid, GIT_OBJECT_ANY)) < 0)
return error;
error = git_object_peel(&obj, oobj, GIT_OBJ_COMMIT);
error = git_object_peel(&obj, oobj, GIT_OBJECT_COMMIT);
git_object_free(oobj);
if (error == GIT_ENOTFOUND || error == GIT_EINVALIDSPEC || error == GIT_EPEEL) {
......
......@@ -140,7 +140,7 @@ int git_libgit2_opts(int key, ...)
case GIT_OPT_SET_CACHE_OBJECT_LIMIT:
{
git_otype type = (git_otype)va_arg(ap, int);
git_object_t type = (git_object_t)va_arg(ap, int);
size_t size = va_arg(ap, size_t);
error = git_cache_set_max_object_size(type, size);
break;
......
......@@ -889,7 +889,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
memset(&entry, 0, sizeof(entry));
entry.path = sm->path;
git_index_entry__init_from_stat(
&entry, &st, !(git_index_caps(index) & GIT_INDEXCAP_NO_FILEMODE));
&entry, &st, !(git_index_caps(index) & GIT_INDEX_CAPABILITY_NO_FILEMODE));
/* calling git_submodule_open will have set sm->wd_oid if possible */
if ((sm->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID) == 0) {
......@@ -1308,12 +1308,12 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
}
/* Look up the target commit in the submodule. */
if ((error = git_object_lookup(&target_commit, sub_repo, oid, GIT_OBJ_COMMIT)) < 0) {
if ((error = git_object_lookup(&target_commit, sub_repo, oid, GIT_OBJECT_COMMIT)) < 0) {
/* If it isn't found then fetch and try again. */
if (error != GIT_ENOTFOUND || !update_options.allow_fetch ||
(error = lookup_default_remote(&remote, sub_repo)) < 0 ||
(error = git_remote_fetch(remote, NULL, &update_options.fetch_opts, NULL)) < 0 ||
(error = git_object_lookup(&target_commit, sub_repo, git_submodule_index_id(sm), GIT_OBJ_COMMIT)) < 0)
(error = git_object_lookup(&target_commit, sub_repo, git_submodule_index_id(sm), GIT_OBJECT_COMMIT)) < 0)
goto done;
}
......
......@@ -36,7 +36,7 @@ const git_oid *git_tag_target_id(const git_tag *t)
return &t->target;
}
git_otype git_tag_target_type(const git_tag *t)
git_object_t git_tag_target_type(const git_tag *t)
{
assert(t);
return t->type;
......@@ -84,7 +84,7 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
return tag_error("type field not found");
buffer += 5;
tag->type = GIT_OBJ_BAD;
tag->type = GIT_OBJECT_BAD;
for (i = 1; i < ARRAY_SIZE(tag_types); ++i) {
size_t type_length = strlen(tag_types[i]);
......@@ -99,7 +99,7 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
}
}
if (tag->type == GIT_OBJ_BAD)
if (tag->type == GIT_OBJECT_BAD)
return tag_error("invalid object type");
if (buffer + 4 >= buffer_end)
......@@ -231,7 +231,7 @@ static int write_tag_annotation(
if (git_repository_odb__weakptr(&odb, repo) < 0)
goto on_error;
if (git_odb_write(oid, odb, tag.ptr, tag.size, GIT_OBJ_TAG) < 0)
if (git_odb_write(oid, odb, tag.ptr, tag.size, GIT_OBJECT_TAG) < 0)
goto on_error;
git_buf_dispose(&tag);
......@@ -377,7 +377,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
/* write the buffer */
if ((error = git_odb_open_wstream(
&stream, odb, strlen(buffer), GIT_OBJ_TAG)) < 0)
&stream, odb, strlen(buffer), GIT_OBJECT_TAG)) < 0)
return error;
if (!(error = git_odb_stream_write(stream, buffer, strlen(buffer))))
......@@ -518,5 +518,5 @@ int git_tag_list(git_strarray *tag_names, git_repository *repo)
int git_tag_peel(git_object **tag_target, const git_tag *tag)
{
return git_object_peel(tag_target, (const git_object *)tag, GIT_OBJ_ANY);
return git_object_peel(tag_target, (const git_object *)tag, GIT_OBJECT_ANY);
}
......@@ -17,7 +17,7 @@ struct git_tag {
git_object object;
git_oid target;
git_otype type;
git_object_t type;
char *tag_name;
git_signature *tagger;
......
......@@ -115,14 +115,14 @@ static int add_ref(transport_local *t, const char *name)
if (git__prefixcmp(name, GIT_REFS_TAGS_DIR))
return 0;
if ((error = git_object_lookup(&obj, t->repo, &head->oid, GIT_OBJ_ANY)) < 0)
if ((error = git_object_lookup(&obj, t->repo, &head->oid, GIT_OBJECT_ANY)) < 0)
return error;
head = NULL;
/* If it's not an annotated tag, or if we're mocking
* git-receive-pack, just get out */
if (git_object_type(obj) != GIT_OBJ_TAG ||
if (git_object_type(obj) != GIT_OBJECT_TAG ||
t->direction != GIT_DIRECTION_FETCH) {
git_object_free(obj);
return 0;
......@@ -563,10 +563,10 @@ static int local_download_pack(
git_vector_foreach(&t->refs, i, rhead) {
git_object *obj;
if ((error = git_object_lookup(&obj, t->repo, &rhead->oid, GIT_OBJ_ANY)) < 0)
if ((error = git_object_lookup(&obj, t->repo, &rhead->oid, GIT_OBJECT_ANY)) < 0)
goto cleanup;
if (git_object_type(obj) == GIT_OBJ_COMMIT) {
if (git_object_type(obj) == GIT_OBJECT_COMMIT) {
/* Revwalker includes only wanted commits */
error = git_revwalk_push(walk, &rhead->oid);
} else {
......
......@@ -271,16 +271,16 @@ const git_oid *git_tree_entry_id(const git_tree_entry *entry)
return entry->oid;
}
git_otype git_tree_entry_type(const git_tree_entry *entry)
git_object_t git_tree_entry_type(const git_tree_entry *entry)
{
assert(entry);
if (S_ISGITLINK(entry->attr))
return GIT_OBJ_COMMIT;
return GIT_OBJECT_COMMIT;
else if (S_ISDIR(entry->attr))
return GIT_OBJ_TREE;
return GIT_OBJECT_TREE;
else
return GIT_OBJ_BLOB;
return GIT_OBJECT_BLOB;
}
int git_tree_entry_to_object(
......@@ -289,7 +289,7 @@ int git_tree_entry_to_object(
const git_tree_entry *entry)
{
assert(entry && object_out);
return git_object_lookup(object_out, repo, entry->oid, GIT_OBJ_ANY);
return git_object_lookup(object_out, repo, entry->oid, GIT_OBJECT_ANY);
}
static const git_tree_entry *entry_fromname(
......@@ -459,15 +459,15 @@ static size_t find_next_dir(const char *dirname, git_index *index, size_t start)
return i;
}
static git_otype otype_from_mode(git_filemode_t filemode)
static git_object_t otype_from_mode(git_filemode_t filemode)
{
switch (filemode) {
case GIT_FILEMODE_TREE:
return GIT_OBJ_TREE;
return GIT_OBJECT_TREE;
case GIT_FILEMODE_COMMIT:
return GIT_OBJ_COMMIT;
return GIT_OBJECT_COMMIT;
default:
return GIT_OBJ_BLOB;
return GIT_OBJECT_BLOB;
}
}
......@@ -840,7 +840,7 @@ int git_treebuilder_write_with_buffer(git_oid *oid, git_treebuilder *bld, git_bu
}
if ((error = git_repository_odb__weakptr(&odb, bld->repo)) == 0)
error = git_odb_write(oid, odb, tree->ptr, tree->size, GIT_OBJ_TREE);
error = git_odb_write(oid, odb, tree->ptr, tree->size, GIT_OBJECT_TREE);
out:
git_vector_free(&entries);
......@@ -1127,7 +1127,7 @@ static int create_popped_tree(tree_stack_entry *current, tree_stack_entry *poppe
if (current->tree) {
const git_tree_entry *to_replace;
to_replace = git_tree_entry_byname(current->tree, component->ptr);
if (to_replace && git_tree_entry_type(to_replace) != GIT_OBJ_TREE) {
if (to_replace && git_tree_entry_type(to_replace) != GIT_OBJECT_TREE) {
giterr_set(GITERR_TREE, "D/F conflict when updating tree");
return -1;
}
......@@ -1204,7 +1204,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
if (!entry)
entry = treebuilder_get(last->bld, component.ptr);
if (entry && git_tree_entry_type(entry) != GIT_OBJ_TREE) {
if (entry && git_tree_entry_type(entry) != GIT_OBJECT_TREE) {
giterr_set(GITERR_TREE, "D/F conflict when updating tree");
error = -1;
goto cleanup;
......
......@@ -13,7 +13,7 @@ static int iterator_compare(const git_index_entry *entry, void *_data)
struct iterator_compare_data *data = (struct iterator_compare_data *)_data;
cl_assert_equal_i(GIT_IDXENTRY_STAGE(entry), data->expected[data->idx].stage);
cl_assert_equal_i(GIT_INDEX_ENTRY_STAGE(entry), data->expected[data->idx].stage);
cl_git_pass(git_oid_fromstr(&expected_id, data->expected[data->idx].oid_str));
cl_assert_equal_oid(&entry->id, &expected_id);
cl_assert_equal_i(entry->mode, data->expected[data->idx].mode);
......@@ -75,7 +75,7 @@ static int iterator_eq(const git_index_entry **entry, void *_data)
if (!entry[0] || !entry[1])
return -1;
cl_assert_equal_i(GIT_IDXENTRY_STAGE(entry[0]), GIT_IDXENTRY_STAGE(entry[1]));
cl_assert_equal_i(GIT_INDEX_ENTRY_STAGE(entry[0]), GIT_INDEX_ENTRY_STAGE(entry[1]));
cl_assert_equal_oid(&entry[0]->id, &entry[1]->id);
cl_assert_equal_i(entry[0]->mode, entry[1]->mode);
cl_assert_equal_s(entry[0]->path, entry[1]->path);
......
......@@ -36,12 +36,12 @@ static void execute_test(void)
/* Verify that the lenna.jpg file was checked out correctly */
cl_git_pass(git_oid_fromstr(&check, "8ab005d890fe53f65eda14b23672f60d9f4ec5a1"));
cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/lenna.jpg", GIT_OBJ_BLOB));
cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/lenna.jpg", GIT_OBJECT_BLOB));
cl_assert_equal_oid(&oid, &check);
/* Verify that the text file was checked out correctly */
cl_git_pass(git_oid_fromstr(&check, "965b223880dd4249e2c66a0cc0b4cffe1dc40f5a"));
cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/utf16_withbom_noeol_crlf.txt", GIT_OBJ_BLOB));
cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/utf16_withbom_noeol_crlf.txt", GIT_OBJECT_BLOB));
cl_assert_equal_oid(&oid, &check);
}
......
......@@ -25,7 +25,7 @@ void reset_index_to_treeish(git_object *treeish)
git_index *index;
git_repository *repo = git_object_owner(treeish);
cl_git_pass(git_object_peel(&tree, treeish, GIT_OBJ_TREE));
cl_git_pass(git_object_peel(&tree, treeish, GIT_OBJECT_TREE));
cl_git_pass(git_repository_index(&index, repo));
cl_git_pass(git_index_read_tree(index, (git_tree *)tree));
......
......@@ -103,7 +103,7 @@ static void create_index(struct checkout_index_entry *entries, size_t entries_le
memset(&entry, 0x0, sizeof(git_index_entry));
entry.mode = entries[i].mode;
GIT_IDXENTRY_STAGE_SET(&entry, entries[i].stage);
GIT_INDEX_ENTRY_STAGE_SET(&entry, entries[i].stage);
git_oid_fromstr(&entry.id, entries[i].oid_str);
entry.path = entries[i].path;
......@@ -156,7 +156,7 @@ static void ensure_workdir_oid(const char *path, const char *oid_str)
git_oid expected, actual;
cl_git_pass(git_oid_fromstr(&expected, oid_str));
cl_git_pass(git_repository_hashfile(&actual, g_repo, path, GIT_OBJ_BLOB, NULL));
cl_git_pass(git_repository_hashfile(&actual, g_repo, path, GIT_OBJECT_BLOB, NULL));
cl_assert_equal_oid(&expected, &actual);
}
......
......@@ -31,7 +31,7 @@ void test_checkout_icase__initialize(void)
cl_skip();
cl_git_pass(git_reference_name_to_id(&id, repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, repo, &id, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, repo, &id, GIT_OBJECT_ANY));
git_checkout_init_options(&checkout_opts, GIT_CHECKOUT_OPTIONS_VERSION);
checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;
......@@ -273,7 +273,7 @@ void test_checkout_icase__conflicts_with_casechanged_subtrees(void)
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
cl_git_pass(git_reference_lookup_resolved(&orig_ref, repo, "HEAD", 100));
cl_git_pass(git_object_lookup(&orig, repo, git_reference_target(orig_ref), GIT_OBJ_COMMIT));
cl_git_pass(git_object_lookup(&orig, repo, git_reference_target(orig_ref), GIT_OBJECT_COMMIT));
cl_git_pass(git_reset(repo, (git_object *)orig, GIT_RESET_HARD, NULL));
cl_must_pass(p_mkdir("testrepo/AB", 0777));
......@@ -281,7 +281,7 @@ void test_checkout_icase__conflicts_with_casechanged_subtrees(void)
cl_git_write2file("testrepo/AB/C/3.txt", "Foobar!\n", 8, O_RDWR|O_CREAT, 0666);
cl_git_pass(git_reference_name_to_id(&oid, repo, "refs/heads/subtrees"));
cl_git_pass(git_object_lookup(&subtrees, repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&subtrees, repo, &oid, GIT_OBJECT_ANY));
cl_git_fail(git_checkout_tree(repo, subtrees, &checkout_opts));
......
......@@ -733,15 +733,15 @@ static void add_conflict(git_index *index, const char *path)
entry.path = path;
git_oid_fromstr(&entry.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
GIT_IDXENTRY_STAGE_SET(&entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 1);
cl_git_pass(git_index_add(index, &entry));
git_oid_fromstr(&entry.id, "4e886e602529caa9ab11d71f86634bd1b6e0de10");
GIT_IDXENTRY_STAGE_SET(&entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 2);
cl_git_pass(git_index_add(index, &entry));
git_oid_fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
GIT_IDXENTRY_STAGE_SET(&entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 3);
cl_git_pass(git_index_add(index, &entry));
}
......
......@@ -170,7 +170,7 @@ void test_checkout_tree__can_switch_branches(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir"));
......@@ -190,7 +190,7 @@ void test_checkout_tree__can_switch_branches(void)
opts.checkout_strategy = GIT_CHECKOUT_SAFE;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/subtrees"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees"));
......@@ -260,7 +260,7 @@ static int checkout_tree_with_blob_ignored_in_workdir(int strategy, bool isdir)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir"));
......@@ -300,7 +300,7 @@ static int checkout_tree_with_blob_ignored_in_workdir(int strategy, bool isdir)
cl_assert_equal_i(1, ignored);
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/subtrees"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
error = git_checkout_tree(g_repo, obj, &opts);
......@@ -374,7 +374,7 @@ void test_checkout_tree__can_update_only(void)
opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir"));
......@@ -541,7 +541,7 @@ void assert_conflict(
/* Hack-ishy workaound to ensure *all* the index entries
* match the content of the tree
*/
cl_git_pass(git_object_peel(&hack_tree, g_object, GIT_OBJ_TREE));
cl_git_pass(git_object_peel(&hack_tree, g_object, GIT_OBJECT_TREE));
cl_git_pass(git_index_read_tree(index, (git_tree *)hack_tree));
cl_git_pass(git_index_write(index));
git_object_free(hack_tree);
......@@ -676,7 +676,7 @@ void test_checkout_tree__can_cancel_checkout_from_notify(void)
assert_on_branch(g_repo, "master");
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
ca.filename = "new.txt";
ca.error = -5555;
......@@ -796,7 +796,7 @@ void test_checkout_tree__can_write_to_empty_dirs(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
......@@ -815,7 +815,7 @@ void test_checkout_tree__fails_when_dir_in_use(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
......@@ -826,7 +826,7 @@ void test_checkout_tree__fails_when_dir_in_use(void)
cl_git_pass(p_chdir("testrepo/a"));
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/master"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_fail(git_checkout_tree(g_repo, obj, &opts));
......@@ -849,7 +849,7 @@ void test_checkout_tree__can_continue_when_dir_in_use(void)
GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
......@@ -860,7 +860,7 @@ void test_checkout_tree__can_continue_when_dir_in_use(void)
cl_git_pass(p_chdir("testrepo/a"));
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/master"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
......@@ -892,7 +892,7 @@ void test_checkout_tree__target_directory_from_bare(void)
opts.notify_payload = &cts;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD"));
cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_fail(git_checkout_tree(g_repo, g_object, &opts));
......@@ -941,16 +941,16 @@ static void create_conflict(const char *path)
memset(&entry, 0x0, sizeof(git_index_entry));
entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 1);
git_oid_fromstr(&entry.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
entry.path = path;
cl_git_pass(git_index_add(index, &entry));
GIT_IDXENTRY_STAGE_SET(&entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 2);
git_oid_fromstr(&entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
cl_git_pass(git_index_add(index, &entry));
GIT_IDXENTRY_STAGE_SET(&entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 3);
git_oid_fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
cl_git_pass(git_index_add(index, &entry));
......@@ -967,7 +967,7 @@ void test_checkout_tree__fails_when_conflicts_exist_in_index(void)
opts.checkout_strategy = GIT_CHECKOUT_SAFE;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
create_conflict("conflicts.txt");
......@@ -1287,7 +1287,7 @@ void test_checkout_tree__can_collect_perfdata(void)
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
......@@ -1328,7 +1328,7 @@ void test_checkout_tree__caches_attributes_during_checkout(void)
opts.paths.count = 2;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/ident"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
......@@ -1363,7 +1363,7 @@ void test_checkout_tree__can_not_update_index(void)
GIT_CHECKOUT_FORCE | GIT_CHECKOUT_DONT_UPDATE_INDEX;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD"));
cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts));
......@@ -1400,7 +1400,7 @@ void test_checkout_tree__can_update_but_not_write_index(void)
GIT_CHECKOUT_FORCE | GIT_CHECKOUT_DONT_WRITE_INDEX;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD"));
cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts));
......@@ -1446,7 +1446,7 @@ void test_checkout_tree__safe_proceeds_if_no_index(void)
opts.checkout_strategy = GIT_CHECKOUT_SAFE;
cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/subtrees"));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(g_repo, obj, &opts));
cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees"));
......@@ -1500,7 +1500,7 @@ void test_checkout_tree__baseline_is_empty_when_no_index(void)
assert_on_branch(g_repo, "master");
cl_git_pass(git_repository_head(&head, g_repo));
cl_git_pass(git_reference_peel(&obj, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel(&obj, head, GIT_OBJECT_COMMIT));
cl_git_pass(git_reset(g_repo, obj, GIT_RESET_HARD, NULL));
......@@ -1539,7 +1539,7 @@ void test_checkout_tree__mode_change_is_force_updated(void)
assert_on_branch(g_repo, "master");
cl_git_pass(git_repository_index(&index, g_repo));
cl_git_pass(git_repository_head(&head, g_repo));
cl_git_pass(git_reference_peel(&obj, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel(&obj, head, GIT_OBJECT_COMMIT));
cl_git_pass(git_reset(g_repo, obj, GIT_RESET_HARD, NULL));
assert_status_entrycount(g_repo, 0);
......@@ -1602,7 +1602,7 @@ static void modify_index_and_checkout_tree(git_checkout_options *opts)
/* External changes to the index are maintained by default */
cl_git_pass(git_repository_index(&index, g_repo));
cl_git_pass(git_repository_head(&head, g_repo));
cl_git_pass(git_reference_peel(&obj, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel(&obj, head, GIT_OBJECT_COMMIT));
cl_git_pass(git_reset(g_repo, obj, GIT_RESET_HARD, NULL));
assert_status_entrycount(g_repo, 0);
......
......@@ -96,8 +96,8 @@ static void assert_workdir_matches_tree(
root = git_repository_workdir(repo);
cl_assert(root);
cl_git_pass(git_object_lookup(&obj, repo, id, GIT_OBJ_ANY));
cl_git_pass(git_object_peel((git_object **)&tree, obj, GIT_OBJ_TREE));
cl_git_pass(git_object_lookup(&obj, repo, id, GIT_OBJECT_ANY));
cl_git_pass(git_object_peel((git_object **)&tree, obj, GIT_OBJECT_TREE));
git_object_free(obj);
max_i = git_tree_entrycount(tree);
......@@ -109,16 +109,16 @@ static void assert_workdir_matches_tree(
cl_git_pass(git_buf_joinpath(&path, root, git_tree_entry_name(te)));
switch (git_tree_entry_type(te)) {
case GIT_OBJ_COMMIT:
case GIT_OBJECT_COMMIT:
assert_dir_exists(path.ptr);
break;
case GIT_OBJ_TREE:
case GIT_OBJECT_TREE:
assert_dir_exists(path.ptr);
if (recurse)
assert_workdir_matches_tree(
repo, git_tree_entry_id(te), path.ptr, true);
break;
case GIT_OBJ_BLOB:
case GIT_OBJECT_BLOB:
switch (git_tree_entry_filemode(te)) {
case GIT_FILEMODE_BLOB:
case GIT_FILEMODE_BLOB_EXECUTABLE:
......
......@@ -370,7 +370,7 @@ void test_cherrypick_workdir__nonmerge_fails_mainline_specified(void)
git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJECT_COMMIT));
opts.mainline = 1;
cl_must_fail(git_cherrypick(repo, commit, &opts));
......
......@@ -269,7 +269,7 @@ void test_clone_nonetwork__clone_tag_to_tree(void)
memset(&entry, 0, sizeof(git_index_entry));
entry.path = file_path;
entry.mode = GIT_FILEMODE_BLOB;
cl_git_pass(git_odb_write(&entry.id, odb, file_content, strlen(file_content), GIT_OBJ_BLOB));
cl_git_pass(git_odb_write(&entry.id, odb, file_content, strlen(file_content), GIT_OBJECT_BLOB));
cl_git_pass(git_index_add(index, &entry));
cl_git_pass(git_index_write_tree_to(&tree_id, index, stage));
......
......@@ -515,7 +515,7 @@ corrupt signature\n";
cl_git_pass(git_repository_odb__weakptr(&odb, g_repo));
cl_git_pass(git_odb_write(&commit_id, odb, passing_commit_cases[4], strlen(passing_commit_cases[4]), GIT_OBJ_COMMIT));
cl_git_pass(git_odb_write(&commit_id, odb, passing_commit_cases[4], strlen(passing_commit_cases[4]), GIT_OBJECT_COMMIT));
cl_git_pass(git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL));
cl_assert_equal_s(gpgsig, signature.ptr);
......@@ -534,14 +534,14 @@ corrupt signature\n";
cl_assert_equal_i(GITERR_INVALID, giterr_last()->klass);
/* Try to parse an unsigned commit */
cl_git_pass(git_odb_write(&commit_id, odb, passing_commit_cases[1], strlen(passing_commit_cases[1]), GIT_OBJ_COMMIT));
cl_git_pass(git_odb_write(&commit_id, odb, passing_commit_cases[1], strlen(passing_commit_cases[1]), GIT_OBJECT_COMMIT));
cl_git_fail_with(GIT_ENOTFOUND, git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL));
cl_assert_equal_i(GITERR_OBJECT, giterr_last()->klass);
/* Parse the commit with a single-line signature */
git_buf_clear(&signature);
git_buf_clear(&signed_data);
cl_git_pass(git_odb_write(&commit_id, odb, oneline_signature, strlen(oneline_signature), GIT_OBJ_COMMIT));
cl_git_pass(git_odb_write(&commit_id, odb, oneline_signature, strlen(oneline_signature), GIT_OBJECT_COMMIT));
cl_git_pass(git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL));
cl_assert_equal_s("bad", signature.ptr);
cl_assert_equal_s(oneline_data, signed_data.ptr);
......
......@@ -12,9 +12,9 @@ git_tree *resolve_commit_oid_to_tree(
git_tree *tree = NULL;
if (git_oid_fromstrn(&oid, partial_oid, len) == 0)
cl_git_pass(git_object_lookup_prefix(&obj, repo, &oid, len, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup_prefix(&obj, repo, &oid, len, GIT_OBJECT_ANY));
cl_git_pass(git_object_peel((git_object **) &tree, obj, GIT_OBJ_TREE));
cl_git_pass(git_object_peel((git_object **) &tree, obj, GIT_OBJECT_TREE));
git_object_free(obj);
return tree;
}
......
......@@ -418,7 +418,7 @@ void test_diff_rename__test_small_files(void)
cl_git_pass(git_index_add_bypath(index, "small.txt"));
cl_git_pass(git_repository_head(&head_reference, g_repo));
cl_git_pass(git_reference_peel((git_object**)&head_commit, head_reference, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel((git_object**)&head_commit, head_reference, GIT_OBJECT_COMMIT));
cl_git_pass(git_commit_tree(&head_tree, head_commit));
cl_git_pass(git_index_write_tree(&oid, index));
cl_git_pass(git_tree_lookup(&commit_tree, g_repo, &oid));
......
......@@ -145,12 +145,12 @@ void test_diff_workdir__to_index_with_assume_unchanged(void)
cl_assert((iep = git_index_get_bypath(idx, "modified_file", 0)) != NULL);
memcpy(&ie, iep, sizeof(ie));
ie.flags |= GIT_IDXENTRY_VALID;
ie.flags |= GIT_INDEX_ENTRY_VALID;
cl_git_pass(git_index_add(idx, &ie));
cl_assert((iep = git_index_get_bypath(idx, "file_deleted", 0)) != NULL);
memcpy(&ie, iep, sizeof(ie));
ie.flags |= GIT_IDXENTRY_VALID;
ie.flags |= GIT_INDEX_ENTRY_VALID;
cl_git_pass(git_index_add(idx, &ie));
cl_git_pass(git_index_write(idx));
......@@ -749,7 +749,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, NULL));
memset(&exp, 0, sizeof(exp));
cl_git_pass(git_diff_foreach(diff,
cl_git_pass(git_diff_foreach(diff,
diff_file_cb, diff_binary_cb, diff_hunk_cb, diff_line_cb, &exp));
cl_assert_equal_i(0, exp.files);
......@@ -2016,7 +2016,7 @@ void test_diff_workdir__only_writes_index_when_necessary(void)
cl_git_pass(git_repository_index(&index, g_repo));
cl_git_pass(git_repository_head(&head, g_repo));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT));
cl_git_pass(git_reset(g_repo, head_object, GIT_RESET_HARD, NULL));
......
......@@ -18,7 +18,7 @@ void test_filter_file__initialize(void)
cl_repo_set_bool(g_repo, "core.autocrlf", true);
cl_git_pass(git_repository_head(&head_ref, g_repo));
cl_git_pass(git_reference_peel((git_object **)&head, head_ref, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel((git_object **)&head, head_ref, GIT_OBJECT_COMMIT));
cl_git_pass(git_reset(g_repo, (git_object *)head, GIT_RESET_HARD, NULL));
git_commit_free(head);
......
......@@ -285,7 +285,7 @@ void test_index_bypath__add_honors_conflict_mode(void)
cl_git_pass(git_index_remove_bypath(g_idx, "README.txt"));
for (stage = 1; stage <= 3; stage++) {
new_entry.flags = stage << GIT_IDXENTRY_STAGESHIFT;
new_entry.flags = stage << GIT_INDEX_ENTRY_STAGESHIFT;
cl_git_pass(git_index_add(g_idx, &new_entry));
}
......@@ -317,7 +317,7 @@ void test_index_bypath__add_honors_conflict_case(void)
cl_git_pass(git_index_remove_bypath(g_idx, "README.txt"));
for (stage = 1; stage <= 3; stage++) {
new_entry.flags = stage << GIT_IDXENTRY_STAGESHIFT;
new_entry.flags = stage << GIT_INDEX_ENTRY_STAGESHIFT;
cl_git_pass(git_index_add(g_idx, &new_entry));
}
......
......@@ -13,7 +13,7 @@ void test_index_collision__initialize(void)
cl_git_pass(git_repository_odb(&g_odb, g_repo));
cl_git_pass(git_repository_index(&g_index, g_repo));
cl_git_pass(git_odb_write(&g_empty_id, g_odb, "", 0, GIT_OBJ_BLOB));
cl_git_pass(git_odb_write(&g_empty_id, g_odb, "", 0, GIT_OBJECT_BLOB));
}
void test_index_collision__cleanup(void)
......@@ -108,7 +108,7 @@ void test_index_collision__add_with_highstage_1(void)
git_oid_cpy(&entry.id, &g_empty_id);
entry.path = "a/b";
GIT_IDXENTRY_STAGE_SET(&entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 2);
cl_git_pass(git_index_add(g_index, &entry));
/* create a blob beneath the previous tree entry */
......@@ -118,7 +118,7 @@ void test_index_collision__add_with_highstage_1(void)
/* create another tree entry above the blob */
entry.path = "a/b";
GIT_IDXENTRY_STAGE_SET(&entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 1);
cl_git_pass(git_index_add(g_index, &entry));
}
......@@ -134,16 +134,16 @@ void test_index_collision__add_with_highstage_2(void)
git_oid_cpy(&entry.id, &g_empty_id);
entry.path = "a/b/c";
GIT_IDXENTRY_STAGE_SET(&entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 1);
cl_git_pass(git_index_add(g_index, &entry));
/* create a blob beneath the previous tree entry */
entry.path = "a/b/c";
GIT_IDXENTRY_STAGE_SET(&entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 2);
cl_git_pass(git_index_add(g_index, &entry));
/* create another tree entry above the blob */
entry.path = "a/b";
GIT_IDXENTRY_STAGE_SET(&entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 3);
cl_git_pass(git_index_add(g_index, &entry));
}
......@@ -36,17 +36,17 @@ void test_index_conflicts__add(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&our_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 2);
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 2);
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
......@@ -67,17 +67,17 @@ void test_index_conflicts__add_fixes_incorrect_stage(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 3);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&our_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 1);
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&their_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 2);
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
......@@ -110,17 +110,17 @@ void test_index_conflicts__add_detects_invalid_filemode(void)
for (i = 0; i < 3; i++) {
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 3);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&our_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 1);
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&their_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 2);
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
/* Corrupt the conflict entry's mode */
......@@ -150,17 +150,17 @@ void test_index_conflicts__add_removes_stage_zero(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 3);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&our_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 1);
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&their_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 2);
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
......@@ -356,7 +356,7 @@ void test_index_conflicts__partial(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, NULL, NULL));
......@@ -386,17 +386,17 @@ void test_index_conflicts__case_matters(void)
memset(&their_entry, 0x0, sizeof(git_index_entry));
ancestor_entry.path = upper_case;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
ancestor_entry.mode = GIT_FILEMODE_BLOB;
our_entry.path = upper_case;
GIT_IDXENTRY_STAGE_SET(&our_entry, GIT_INDEX_STAGE_OURS);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, GIT_INDEX_STAGE_OURS);
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
our_entry.mode = GIT_FILEMODE_BLOB;
their_entry.path = upper_case;
GIT_IDXENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
their_entry.mode = GIT_FILEMODE_BLOB;
......@@ -404,17 +404,17 @@ void test_index_conflicts__case_matters(void)
&ancestor_entry, &our_entry, &their_entry));
ancestor_entry.path = mixed_case;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_TWO_ANCESTOR_OID);
ancestor_entry.mode = GIT_FILEMODE_BLOB;
our_entry.path = mixed_case;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
git_oid_fromstr(&our_entry.id, CONFLICTS_TWO_OUR_OID);
ancestor_entry.mode = GIT_FILEMODE_BLOB;
their_entry.path = mixed_case;
GIT_IDXENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
git_oid_fromstr(&their_entry.id, CONFLICTS_TWO_THEIR_OID);
their_entry.mode = GIT_FILEMODE_BLOB;
......
......@@ -78,7 +78,7 @@ void test_index_filemodes__untrusted(void)
cl_repo_set_bool(g_repo, "core.filemode", false);
cl_git_pass(git_repository_index(&index, g_repo));
cl_assert((git_index_caps(index) & GIT_INDEXCAP_NO_FILEMODE) != 0);
cl_assert((git_index_caps(index) & GIT_INDEX_CAPABILITY_NO_FILEMODE) != 0);
/* 1 - add 0644 over existing 0644 -> expect 0644 */
replace_file_with_mode("exec_off", "filemodes/exec_off.0", 0644);
......@@ -122,7 +122,7 @@ void test_index_filemodes__trusted(void)
cl_repo_set_bool(g_repo, "core.filemode", true);
cl_git_pass(git_repository_index(&index, g_repo));
cl_assert((git_index_caps(index) & GIT_INDEXCAP_NO_FILEMODE) == 0);
cl_assert((git_index_caps(index) & GIT_INDEX_CAPABILITY_NO_FILEMODE) == 0);
/* 1 - add 0644 over existing 0644 -> expect 0644 */
replace_file_with_mode("exec_off", "filemodes/exec_off.0", 0644);
......@@ -245,9 +245,9 @@ void test_index_filemodes__invalid(void)
cl_git_pass(git_index_add_bypath(index, "dummy-file.txt"));
cl_assert((dummy = git_index_get_bypath(index, "dummy-file.txt", 0)));
GIT_IDXENTRY_STAGE_SET(&entry, 0);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 0);
entry.path = "foo";
entry.mode = GIT_OBJ_BLOB;
entry.mode = GIT_OBJECT_BLOB;
git_oid_cpy(&entry.id, &dummy->id);
cl_git_fail(git_index_add(index, &entry));
......
......@@ -41,21 +41,21 @@ static void index_add_conflicts(void)
/* ancestor */
entry.path = conflict[0];
entry.mode = GIT_FILEMODE_BLOB;
GIT_IDXENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_ANCESTOR);
GIT_INDEX_ENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_ANCESTOR);
git_oid_fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81");
cl_git_pass(git_index_add(repo_index, &entry));
/* ours */
entry.path = conflict[1];
entry.mode = GIT_FILEMODE_BLOB;
GIT_IDXENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_OURS);
GIT_INDEX_ENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_OURS);
git_oid_fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81");
cl_git_pass(git_index_add(repo_index, &entry));
/* theirs */
entry.path = conflict[2];
entry.mode = GIT_FILEMODE_BLOB;
GIT_IDXENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_THEIRS);
GIT_INDEX_ENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_THEIRS);
git_oid_fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81");
cl_git_pass(git_index_add(repo_index, &entry));
}
......@@ -157,7 +157,7 @@ void test_index_names__cleaned_on_checkout_tree(void)
test_index_names__add();
cl_git_pass(git_reference_name_to_id(&oid, repo, "refs/heads/master"));
cl_git_pass(git_object_lookup(&obj, repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(repo, obj, &opts));
cl_assert_equal_sz(0, git_index_name_entrycount(repo_index));
......
......@@ -210,13 +210,13 @@ void test_index_racy__adding_to_index_is_uptodate(void)
/* ensure that they're all uptodate */
cl_assert((entry = git_index_get_bypath(index, "A", 0)));
cl_assert_equal_i(GIT_IDXENTRY_UPTODATE, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(GIT_INDEX_ENTRY_UPTODATE, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "B", 0)));
cl_assert_equal_i(GIT_IDXENTRY_UPTODATE, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(GIT_INDEX_ENTRY_UPTODATE, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "C", 0)));
cl_assert_equal_i(GIT_IDXENTRY_UPTODATE, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(GIT_INDEX_ENTRY_UPTODATE, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_git_pass(git_index_write(index));
......@@ -237,13 +237,13 @@ void test_index_racy__reading_clears_uptodate_bit(void)
/* ensure that no files are uptodate */
cl_assert((entry = git_index_get_bypath(index, "A", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "B", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "C", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
git_index_free(index);
}
......@@ -264,13 +264,13 @@ void test_index_racy__read_tree_clears_uptodate_bit(void)
/* ensure that no files are uptodate */
cl_assert((entry = git_index_get_bypath(index, "A", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "B", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "C", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
git_tree_free(tree);
git_index_free(index);
......@@ -311,13 +311,13 @@ void test_index_racy__read_index_clears_uptodate_bit(void)
/* ensure that files brought in from the other index are not uptodate */
cl_assert((entry = git_index_get_bypath(newindex, "A", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(newindex, "B", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(newindex, "C", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
git_index_free(index);
git_index_free(newindex);
......
......@@ -147,17 +147,17 @@ static void add_conflicts(git_index *index, const char *filename)
ancestor_entry.path = filename;
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
git_oid_fromstr(&ancestor_entry.id, ancestor_ids[conflict_idx]);
our_entry.path = filename;
our_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&our_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 2);
git_oid_fromstr(&our_entry.id, our_ids[conflict_idx]);
their_entry.path = filename;
their_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 2);
git_oid_fromstr(&their_entry.id, their_ids[conflict_idx]);
cl_git_pass(git_index_conflict_add(index, &ancestor_entry,
......
......@@ -129,12 +129,12 @@ void test_index_reuc__ignore_case(void)
index_caps = git_index_caps(repo_index);
index_caps &= ~GIT_INDEXCAP_IGNORE_CASE;
index_caps &= ~GIT_INDEX_CAPABILITY_IGNORE_CASE;
cl_git_pass(git_index_set_caps(repo_index, index_caps));
cl_assert(!git_index_reuc_get_bypath(repo_index, "TWO.txt"));
index_caps |= GIT_INDEXCAP_IGNORE_CASE;
index_caps |= GIT_INDEX_CAPABILITY_IGNORE_CASE;
cl_git_pass(git_index_set_caps(repo_index, index_caps));
cl_assert_equal_i(2, git_index_reuc_entrycount(repo_index));
......@@ -197,7 +197,7 @@ void test_index_reuc__updates_existing(void)
index_caps = git_index_caps(repo_index);
index_caps |= GIT_INDEXCAP_IGNORE_CASE;
index_caps |= GIT_INDEX_CAPABILITY_IGNORE_CASE;
cl_git_pass(git_index_set_caps(repo_index, index_caps));
git_oid_fromstr(&ancestor_oid, TWO_ANCESTOR_OID);
......@@ -346,7 +346,7 @@ void test_index_reuc__cleaned_on_checkout_tree(void)
test_index_reuc__add();
cl_git_pass(git_reference_name_to_id(&oid, repo, "refs/heads/master"));
cl_git_pass(git_object_lookup(&obj, repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_checkout_tree(repo, obj, &opts));
cl_assert(reuc_entry_exists() == false);
......
......@@ -810,7 +810,7 @@ void test_index_tests__preserves_case(void)
cl_git_rewritefile("myrepo/TEST.txt", "hello again\n");
cl_git_pass(git_index_add_bypath(index, "TEST.txt"));
if (index_caps & GIT_INDEXCAP_IGNORE_CASE)
if (index_caps & GIT_INDEX_CAPABILITY_IGNORE_CASE)
cl_assert_equal_i(1, (int)git_index_entrycount(index));
else
cl_assert_equal_i(2, (int)git_index_entrycount(index));
......@@ -821,7 +821,7 @@ void test_index_tests__preserves_case(void)
cl_assert(git__strcmp(entry->path, "test.txt") == 0);
cl_assert((entry = git_index_get_bypath(index, "TEST.txt", 0)) != NULL);
if (index_caps & GIT_INDEXCAP_IGNORE_CASE)
if (index_caps & GIT_INDEX_CAPABILITY_IGNORE_CASE)
/* The path should *not* have changed without an explicit remove */
cl_assert(git__strcmp(entry->path, "test.txt") == 0);
else
......@@ -923,13 +923,13 @@ void test_index_tests__reload_while_ignoring_case(void)
cl_git_pass(git_vector_verify_sorted(&index->entries));
caps = git_index_caps(index);
cl_git_pass(git_index_set_caps(index, caps &= ~GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps &= ~GIT_INDEX_CAPABILITY_IGNORE_CASE));
cl_git_pass(git_index_read(index, true));
cl_git_pass(git_vector_verify_sorted(&index->entries));
cl_assert(git_index_get_bypath(index, ".HEADER", 0));
cl_assert_equal_p(NULL, git_index_get_bypath(index, ".header", 0));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEX_CAPABILITY_IGNORE_CASE));
cl_git_pass(git_index_read(index, true));
cl_git_pass(git_vector_verify_sorted(&index->entries));
cl_assert(git_index_get_bypath(index, ".HEADER", 0));
......@@ -948,7 +948,7 @@ void test_index_tests__change_icase_on_instance(void)
cl_git_pass(git_vector_verify_sorted(&index->entries));
caps = git_index_caps(index);
cl_git_pass(git_index_set_caps(index, caps &= ~GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps &= ~GIT_INDEX_CAPABILITY_IGNORE_CASE));
cl_assert_equal_i(false, index->ignore_case);
cl_git_pass(git_vector_verify_sorted(&index->entries));
cl_assert(e = git_index_get_bypath(index, "src/common.h", 0));
......@@ -956,7 +956,7 @@ void test_index_tests__change_icase_on_instance(void)
cl_assert(e = git_index_get_bypath(index, "COPYING", 0));
cl_assert_equal_p(NULL, e = git_index_get_bypath(index, "copying", 0));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEX_CAPABILITY_IGNORE_CASE));
cl_assert_equal_i(true, index->ignore_case);
cl_git_pass(git_vector_verify_sorted(&index->entries));
cl_assert(e = git_index_get_bypath(index, "COPYING", 0));
......
......@@ -222,10 +222,10 @@ static void check_index_range(
cl_git_pass(git_repository_index(&index, repo));
caps = git_index_caps(index);
is_ignoring_case = ((caps & GIT_INDEXCAP_IGNORE_CASE) != 0);
is_ignoring_case = ((caps & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0);
if (ignore_case != is_ignoring_case)
cl_git_pass(git_index_set_caps(index, caps ^ GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps ^ GIT_INDEX_CAPABILITY_IGNORE_CASE));
i_opts.flags = 0;
i_opts.start = start;
......@@ -363,7 +363,7 @@ void test_iterator_index__icase_1(void)
caps = git_index_caps(index);
/* force case sensitivity */
cl_git_pass(git_index_set_caps(index, caps & ~GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps & ~GIT_INDEX_CAPABILITY_IGNORE_CASE));
/* autoexpand with no tree entries over range */
i_opts.start = "c";
......@@ -409,7 +409,7 @@ void test_iterator_index__icase_1(void)
git_iterator_free(i);
/* force case insensitivity */
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEX_CAPABILITY_IGNORE_CASE));
/* autoexpand with no tree entries over range */
i_opts.flags = 0;
......@@ -783,7 +783,7 @@ void test_iterator_index__pathlist_1(void)
cl_git_pass(git_vector_insert(&filelist, "k/a"));
/* In this test we DO NOT force a case setting on the index. */
default_icase = ((git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0);
default_icase = ((git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0);
i_opts.pathlist.strings = (char **)filelist.contents;
i_opts.pathlist.count = filelist.length;
......@@ -825,7 +825,7 @@ void test_iterator_index__pathlist_2(void)
cl_git_pass(git_vector_insert(&filelist, "kZZZZZZZ"));
/* In this test we DO NOT force a case setting on the index. */
default_icase = ((git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0);
default_icase = ((git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0);
i_opts.pathlist.strings = (char **)filelist.contents;
i_opts.pathlist.count = filelist.length;
......@@ -867,7 +867,7 @@ void test_iterator_index__pathlist_four(void)
cl_git_pass(git_vector_insert(&filelist, "kZZZZZZZ"));
/* In this test we DO NOT force a case setting on the index. */
default_icase = ((git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0);
default_icase = ((git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0);
i_opts.pathlist.strings = (char **)filelist.contents;
i_opts.pathlist.count = filelist.length;
......@@ -910,7 +910,7 @@ void test_iterator_index__pathlist_icase(void)
caps = git_index_caps(index);
/* force case sensitivity */
cl_git_pass(git_index_set_caps(index, caps & ~GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps & ~GIT_INDEX_CAPABILITY_IGNORE_CASE));
/* All indexfilelist iterator tests are "autoexpand with no tree entries" */
......@@ -930,7 +930,7 @@ void test_iterator_index__pathlist_icase(void)
git_iterator_free(i);
/* force case insensitivity */
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEX_CAPABILITY_IGNORE_CASE));
i_opts.start = "c";
i_opts.end = "k/D";
......@@ -1297,17 +1297,17 @@ static void add_conflict(
ancestor.path = ancestor_path;
ancestor.mode = GIT_FILEMODE_BLOB;
git_oid_fromstr(&ancestor.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6");
GIT_IDXENTRY_STAGE_SET(&ancestor, 1);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor, 1);
ours.path = our_path;
ours.mode = GIT_FILEMODE_BLOB;
git_oid_fromstr(&ours.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6");
GIT_IDXENTRY_STAGE_SET(&ours, 2);
GIT_INDEX_ENTRY_STAGE_SET(&ours, 2);
theirs.path = their_path;
theirs.mode = GIT_FILEMODE_BLOB;
git_oid_fromstr(&theirs.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6");
GIT_IDXENTRY_STAGE_SET(&theirs, 3);
GIT_INDEX_ENTRY_STAGE_SET(&theirs, 3);
cl_git_pass(git_index_conflict_add(index, &ancestor, &ours, &theirs));
}
......
......@@ -100,7 +100,7 @@ void test_merge_trees_automerge__automerge(void)
cl_assert((entry = git_index_get_bypath(index, "automergeable.txt", 0)) != NULL);
cl_assert(entry->file_size == strlen(AUTOMERGEABLE_MERGED_FILE));
cl_git_pass(git_object_lookup((git_object **)&blob, repo, &entry->id, GIT_OBJ_BLOB));
cl_git_pass(git_object_lookup((git_object **)&blob, repo, &entry->id, GIT_OBJECT_BLOB));
cl_assert(memcmp(git_blob_rawcontent(blob), AUTOMERGEABLE_MERGED_FILE, (size_t)entry->file_size) == 0);
git_index_free(index);
......
......@@ -62,7 +62,7 @@ void test_merge_trees_commits__automerge(void)
cl_assert((entry = git_index_get_bypath(index, "automergeable.txt", 0)) != NULL);
cl_assert(entry->file_size == strlen(AUTOMERGEABLE_MERGED_FILE));
cl_git_pass(git_object_lookup((git_object **)&blob, repo, &entry->id, GIT_OBJ_BLOB));
cl_git_pass(git_object_lookup((git_object **)&blob, repo, &entry->id, GIT_OBJECT_BLOB));
cl_assert(memcmp(git_blob_rawcontent(blob), AUTOMERGEABLE_MERGED_FILE, (size_t)entry->file_size) == 0);
git_index_free(index);
......@@ -137,12 +137,12 @@ void test_merge_trees_commits__fail_on_conflict(void)
opts.flags |= GIT_MERGE_FAIL_ON_CONFLICT;
cl_git_fail_with(GIT_EMERGECONFLICT,
cl_git_fail_with(GIT_EMERGECONFLICT,
merge_trees_from_branches(&index, repo, "df_side1", "df_side2", &opts));
cl_git_fail_with(GIT_EMERGECONFLICT,
cl_git_fail_with(GIT_EMERGECONFLICT,
merge_commits_from_branches(&index, repo, "master", "unrelated", &opts));
cl_git_fail_with(GIT_EMERGECONFLICT,
cl_git_fail_with(GIT_EMERGECONFLICT,
merge_commits_from_branches(&index, repo, "master", "branch", &opts));
}
......@@ -201,7 +201,7 @@ static void stage_content(char *content[])
size_t i;
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT));
cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL));
for (i = 0, filename = content[i], text = content[++i];
......@@ -228,7 +228,7 @@ static int merge_dirty_files(char *dirty_files[])
int error;
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT));
cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL));
write_files(dirty_files);
......@@ -248,7 +248,7 @@ static int merge_differently_filtered_files(char *files[])
int error;
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT));
cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL));
/* Emulate checkout with a broken or misconfigured filter: modify some
......@@ -275,7 +275,7 @@ static int merge_differently_filtered_files(char *files[])
}
static int merge_staged_files(char *staged_files[])
{
{
stage_random_files(staged_files);
return merge_branch();
}
......@@ -295,7 +295,7 @@ void test_merge_workdir_dirty__unstaged_deletes_maintained(void)
git_object *head_object;
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT));
cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL));
cl_git_pass(p_unlink("merge-resolve/unchanged.txt"));
......@@ -333,7 +333,7 @@ void test_merge_workdir_dirty__identical_staged_files_allowed(void)
size_t i;
set_core_autocrlf_to(repo, false);
for (i = 0, content = result_contents[i]; content[0]; content = result_contents[++i]) {
stage_content(content);
......
......@@ -27,7 +27,7 @@ void test_object_blob_fromstream__multiple_write(void)
cl_git_pass(git_oid_fromstr(&expected_id, "321cbdf08803c744082332332838df6bd160f8f9"));
cl_git_fail_with(GIT_ENOTFOUND,
git_object_lookup(&blob, repo, &expected_id, GIT_OBJ_ANY));
git_object_lookup(&blob, repo, &expected_id, GIT_OBJECT_ANY));
cl_git_pass(git_blob_create_fromstream(&stream, repo, NULL));
......@@ -37,7 +37,7 @@ void test_object_blob_fromstream__multiple_write(void)
cl_git_pass(git_blob_create_fromstream_commit(&id, stream));
cl_assert_equal_oid(&expected_id, &id);
cl_git_pass(git_object_lookup(&blob, repo, &expected_id, GIT_OBJ_BLOB));
cl_git_pass(git_object_lookup(&blob, repo, &expected_id, GIT_OBJECT_BLOB));
git_object_free(blob);
}
......
......@@ -13,33 +13,33 @@ void test_object_cache__cleanup(void)
git_repository_free(g_repo);
g_repo = NULL;
git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJ_BLOB, (size_t)0);
git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJECT_BLOB, (size_t)0);
}
static struct {
git_otype type;
git_object_t type;
const char *sha;
} g_data[] = {
/* HEAD */
{ GIT_OBJ_BLOB, "a8233120f6ad708f843d861ce2b7228ec4e3dec6" }, /* README */
{ GIT_OBJ_BLOB, "3697d64be941a53d4ae8f6a271e4e3fa56b022cc" }, /* branch_file.txt */
{ GIT_OBJ_BLOB, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd" }, /* new.txt */
{ GIT_OBJECT_BLOB, "a8233120f6ad708f843d861ce2b7228ec4e3dec6" }, /* README */
{ GIT_OBJECT_BLOB, "3697d64be941a53d4ae8f6a271e4e3fa56b022cc" }, /* branch_file.txt */
{ GIT_OBJECT_BLOB, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd" }, /* new.txt */
/* refs/heads/subtrees */
{ GIT_OBJ_BLOB, "1385f264afb75a56a5bec74243be9b367ba4ca08" }, /* README */
{ GIT_OBJ_TREE, "f1425cef211cc08caa31e7b545ffb232acb098c3" }, /* ab */
{ GIT_OBJ_BLOB, "d6c93164c249c8000205dd4ec5cbca1b516d487f" }, /* ab/4.txt */
{ GIT_OBJ_TREE, "9a03079b8a8ee85a0bee58bf9be3da8b62414ed4" }, /* ab/c */
{ GIT_OBJ_BLOB, "270b8ea76056d5cad83af921837702d3e3c2924d" }, /* ab/c/3.txt */
{ GIT_OBJ_TREE, "b6361fc6a97178d8fc8639fdeed71c775ab52593" }, /* ab/de */
{ GIT_OBJ_BLOB, "e7b4ad382349ff96dd8199000580b9b1e2042eb0" }, /* ab/de/2.txt */
{ GIT_OBJ_TREE, "3259a6bd5b57fb9c1281bb7ed3167b50f224cb54" }, /* ab/de/fgh */
{ GIT_OBJ_BLOB, "1f67fc4386b2d171e0d21be1c447e12660561f9b" }, /* ab/de/fgh/1.txt */
{ GIT_OBJ_BLOB, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057" }, /* branch_file.txt */
{ GIT_OBJ_BLOB, "fa49b077972391ad58037050f2a75f74e3671e92" }, /* new.txt */
{ GIT_OBJECT_BLOB, "1385f264afb75a56a5bec74243be9b367ba4ca08" }, /* README */
{ GIT_OBJECT_TREE, "f1425cef211cc08caa31e7b545ffb232acb098c3" }, /* ab */
{ GIT_OBJECT_BLOB, "d6c93164c249c8000205dd4ec5cbca1b516d487f" }, /* ab/4.txt */
{ GIT_OBJECT_TREE, "9a03079b8a8ee85a0bee58bf9be3da8b62414ed4" }, /* ab/c */
{ GIT_OBJECT_BLOB, "270b8ea76056d5cad83af921837702d3e3c2924d" }, /* ab/c/3.txt */
{ GIT_OBJECT_TREE, "b6361fc6a97178d8fc8639fdeed71c775ab52593" }, /* ab/de */
{ GIT_OBJECT_BLOB, "e7b4ad382349ff96dd8199000580b9b1e2042eb0" }, /* ab/de/2.txt */
{ GIT_OBJECT_TREE, "3259a6bd5b57fb9c1281bb7ed3167b50f224cb54" }, /* ab/de/fgh */
{ GIT_OBJECT_BLOB, "1f67fc4386b2d171e0d21be1c447e12660561f9b" }, /* ab/de/fgh/1.txt */
{ GIT_OBJECT_BLOB, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057" }, /* branch_file.txt */
{ GIT_OBJECT_BLOB, "fa49b077972391ad58037050f2a75f74e3671e92" }, /* new.txt */
/* refs/heads/chomped */
{ GIT_OBJ_BLOB, "0266163a49e280c4f5ed1e08facd36a2bd716bcf" }, /* readme.txt */
{ GIT_OBJECT_BLOB, "0266163a49e280c4f5ed1e08facd36a2bd716bcf" }, /* readme.txt */
{ 0, NULL },
{ 0, NULL }
......@@ -54,7 +54,7 @@ void test_object_cache__cache_everything(void)
git_odb *odb;
git_libgit2_opts(
GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJ_BLOB, (size_t)32767);
GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJECT_BLOB, (size_t)32767);
cl_git_pass(git_repository_open(&g_repo, cl_fixture("testrepo.git")));
cl_git_pass(git_repository_odb(&odb, g_repo));
......@@ -72,7 +72,7 @@ void test_object_cache__cache_everything(void)
cl_assert(g_data[i].type == git_odb_object_type(odb_obj));
git_odb_object_free(odb_obj);
} else {
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert(g_data[i].type == git_object_type(obj));
git_object_free(obj);
}
......@@ -88,7 +88,7 @@ void test_object_cache__cache_everything(void)
int count = (int)git_cache_size(&g_repo->objects);
cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert(g_data[i].type == git_object_type(obj));
git_object_free(obj);
......@@ -104,7 +104,7 @@ void test_object_cache__cache_no_blobs(void)
git_object *obj;
git_odb *odb;
git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJ_BLOB, (size_t)0);
git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJECT_BLOB, (size_t)0);
cl_git_pass(git_repository_open(&g_repo, cl_fixture("testrepo.git")));
cl_git_pass(git_repository_odb(&odb, g_repo));
......@@ -122,12 +122,12 @@ void test_object_cache__cache_no_blobs(void)
cl_assert(g_data[i].type == git_odb_object_type(odb_obj));
git_odb_object_free(odb_obj);
} else {
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert(g_data[i].type == git_object_type(obj));
git_object_free(obj);
}
if (g_data[i].type == GIT_OBJ_BLOB)
if (g_data[i].type == GIT_OBJECT_BLOB)
cl_assert_equal_i(count, (int)git_cache_size(&g_repo->objects));
else {
cl_assert_equal_i(count + 1, (int)git_cache_size(&g_repo->objects));
......@@ -148,14 +148,14 @@ static void *cache_parsed(void *arg)
for (i = ((int *)arg)[1]; g_data[i].sha != NULL; i += 2) {
cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert(g_data[i].type == git_object_type(obj));
git_object_free(obj);
}
for (i = 0; i < ((int *)arg)[1]; i += 2) {
cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert(g_data[i].type == git_object_type(obj));
git_object_free(obj);
}
......@@ -246,7 +246,7 @@ static void *cache_quick(void *arg)
git_object *obj;
cl_git_pass(git_oid_fromstr(&oid, g_data[4].sha));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert(g_data[4].type == git_object_type(obj));
git_object_free(obj);
......
......@@ -14,7 +14,7 @@ static void assert_commit_parses(const char *data, size_t datalen,
git_commit *commit;
if (!datalen)
datalen = strlen(data);
cl_git_pass(git_object__from_raw((git_object **) &commit, data, datalen, GIT_OBJ_COMMIT));
cl_git_pass(git_object__from_raw((git_object **) &commit, data, datalen, GIT_OBJECT_COMMIT));
if (expected_author) {
git_signature *author;
......@@ -65,7 +65,7 @@ static void assert_commit_fails(const char *data, size_t datalen)
git_object *object;
if (!datalen)
datalen = strlen(data);
cl_git_fail(git_object__from_raw(&object, data, datalen, GIT_OBJ_COMMIT));
cl_git_fail(git_object__from_raw(&object, data, datalen, GIT_OBJECT_COMMIT));
}
void test_object_commit_parse__parsing_commit_succeeds(void)
......
......@@ -22,7 +22,7 @@ void test_object_lookup__lookup_wrong_type_returns_enotfound(void)
cl_git_pass(git_oid_fromstr(&oid, commit));
cl_assert_equal_i(
GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJ_TAG));
GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_TAG));
}
void test_object_lookup__lookup_nonexisting_returns_enotfound(void)
......@@ -33,7 +33,7 @@ void test_object_lookup__lookup_nonexisting_returns_enotfound(void)
cl_git_pass(git_oid_fromstr(&oid, unknown));
cl_assert_equal_i(
GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJ_ANY));
GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_ANY));
}
void test_object_lookup__lookup_wrong_type_by_abbreviated_id_returns_enotfound(void)
......@@ -44,7 +44,7 @@ void test_object_lookup__lookup_wrong_type_by_abbreviated_id_returns_enotfound(v
cl_git_pass(git_oid_fromstrn(&oid, commit, strlen(commit)));
cl_assert_equal_i(
GIT_ENOTFOUND, git_object_lookup_prefix(&object, g_repo, &oid, strlen(commit), GIT_OBJ_TAG));
GIT_ENOTFOUND, git_object_lookup_prefix(&object, g_repo, &oid, strlen(commit), GIT_OBJECT_TAG));
}
void test_object_lookup__lookup_wrong_type_eventually_returns_enotfound(void)
......@@ -55,11 +55,11 @@ void test_object_lookup__lookup_wrong_type_eventually_returns_enotfound(void)
cl_git_pass(git_oid_fromstr(&oid, commit));
cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJ_COMMIT));
cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT));
git_object_free(object);
cl_assert_equal_i(
GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJ_TAG));
GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_TAG));
}
void test_object_lookup__lookup_corrupt_object_returns_error(void)
......@@ -79,13 +79,13 @@ void test_object_lookup__lookup_corrupt_object_returns_error(void)
for (i = 0; i < contents.size; i++) {
contents.ptr[i] ^= 0x1;
cl_git_pass(git_futils_writebuffer(&contents, path.ptr, O_RDWR, 0644));
cl_git_fail(git_object_lookup(&object, g_repo, &oid, GIT_OBJ_COMMIT));
cl_git_fail(git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT));
contents.ptr[i] ^= 0x1;
}
/* Restore original content and assert we can read the object */
cl_git_pass(git_futils_writebuffer(&contents, path.ptr, O_RDWR, 0644));
cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJ_COMMIT));
cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT));
git_object_free(object);
git_buf_dispose(&path);
......@@ -109,11 +109,11 @@ void test_object_lookup__lookup_object_with_wrong_hash_returns_error(void)
cl_git_pass(git_futils_cp(oldpath.ptr, newpath.ptr, 0644));
/* Verify that lookup fails due to a hashsum mismatch */
cl_git_fail_with(GIT_EMISMATCH, git_object_lookup(&object, g_repo, &oid, GIT_OBJ_COMMIT));
cl_git_fail_with(GIT_EMISMATCH, git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT));
/* Disable verification and try again */
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 0));
cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJ_COMMIT));
cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT));
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 1));
git_object_free(object);
......
......@@ -16,11 +16,11 @@ void test_object_lookupbypath__initialize(void)
cl_git_pass(git_repository_open(&g_repo, cl_fixture("attr/.gitted")));
cl_git_pass(git_repository_head(&head, g_repo));
cl_git_pass(git_reference_peel((git_object**)&g_head_commit, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reference_peel((git_object**)&g_head_commit, head, GIT_OBJECT_COMMIT));
cl_git_pass(git_commit_tree(&g_root_tree, g_head_commit));
cl_git_pass(git_tree_entry_bypath(&tree_entry, g_root_tree, "subdir/subdir_test2.txt"));
cl_git_pass(git_object_lookup(&g_expectedobject, g_repo, git_tree_entry_id(tree_entry),
GIT_OBJ_ANY));
GIT_OBJECT_ANY));
git_tree_entry_free(tree_entry);
git_reference_free(head);
......@@ -42,16 +42,16 @@ void test_object_lookupbypath__errors(void)
{
cl_assert_equal_i(GIT_EINVALIDSPEC,
git_object_lookup_bypath(&g_actualobject, (git_object*)g_root_tree,
"subdir/subdir_test2.txt", GIT_OBJ_TREE)); /* It's not a tree */
"subdir/subdir_test2.txt", GIT_OBJECT_TREE)); /* It's not a tree */
cl_assert_equal_i(GIT_ENOTFOUND,
git_object_lookup_bypath(&g_actualobject, (git_object*)g_root_tree,
"file/doesnt/exist", GIT_OBJ_ANY));
"file/doesnt/exist", GIT_OBJECT_ANY));
}
void test_object_lookupbypath__from_root_tree(void)
{
cl_git_pass(git_object_lookup_bypath(&g_actualobject, (git_object*)g_root_tree,
"subdir/subdir_test2.txt", GIT_OBJ_BLOB));
"subdir/subdir_test2.txt", GIT_OBJECT_BLOB));
cl_assert_equal_oid(git_object_id(g_expectedobject),
git_object_id(g_actualobject));
}
......@@ -59,7 +59,7 @@ void test_object_lookupbypath__from_root_tree(void)
void test_object_lookupbypath__from_head_commit(void)
{
cl_git_pass(git_object_lookup_bypath(&g_actualobject, (git_object*)g_head_commit,
"subdir/subdir_test2.txt", GIT_OBJ_BLOB));
"subdir/subdir_test2.txt", GIT_OBJECT_BLOB));
cl_assert_equal_oid(git_object_id(g_expectedobject),
git_object_id(g_actualobject));
}
......@@ -73,7 +73,7 @@ void test_object_lookupbypath__from_subdir_tree(void)
cl_git_pass(git_tree_lookup(&tree, g_repo, git_tree_entry_id(entry)));
cl_git_pass(git_object_lookup_bypath(&g_actualobject, (git_object*)tree,
"subdir_test2.txt", GIT_OBJ_BLOB));
"subdir_test2.txt", GIT_OBJECT_BLOB));
cl_assert_equal_oid(git_object_id(g_expectedobject),
git_object_id(g_actualobject));
......
......@@ -15,17 +15,17 @@ void test_object_peel__cleanup(void)
static void assert_peel(
const char *sha,
git_otype requested_type,
git_object_t requested_type,
const char* expected_sha,
git_otype expected_type)
git_object_t expected_type)
{
git_oid oid, expected_oid;
git_object *obj;
git_object *peeled;
cl_git_pass(git_oid_fromstr(&oid, sha));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_git_pass(git_object_peel(&peeled, obj, requested_type));
cl_git_pass(git_oid_fromstr(&expected_oid, expected_sha));
......@@ -37,15 +37,15 @@ static void assert_peel(
git_object_free(obj);
}
static void assert_peel_error(int error, const char *sha, git_otype requested_type)
static void assert_peel_error(int error, const char *sha, git_object_t requested_type)
{
git_oid oid;
git_object *obj;
git_object *peeled;
cl_git_pass(git_oid_fromstr(&oid, sha));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY));
cl_assert_equal_i(error, git_object_peel(&peeled, obj, requested_type));
git_object_free(obj);
......@@ -53,66 +53,66 @@ static void assert_peel_error(int error, const char *sha, git_otype requested_ty
void test_object_peel__peeling_an_object_into_its_own_type_returns_another_instance_of_it(void)
{
assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT,
"e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT);
assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_TAG,
"7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_TAG);
assert_peel("53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE);
assert_peel("0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_BLOB,
"0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_BLOB);
assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT,
"e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT);
assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_TAG,
"7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_TAG);
assert_peel("53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE);
assert_peel("0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_BLOB,
"0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_BLOB);
}
void test_object_peel__tag(void)
{
assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_COMMIT,
"e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT);
assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_TREE,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE);
assert_peel_error(GIT_EPEEL, "7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_BLOB);
assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_ANY,
"e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT);
assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_COMMIT,
"e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT);
assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_TREE,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE);
assert_peel_error(GIT_EPEEL, "7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_BLOB);
assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_ANY,
"e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT);
}
void test_object_peel__commit(void)
{
assert_peel_error(GIT_EINVALIDSPEC, "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_BLOB);
assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_TREE,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE);
assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT,
"e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT);
assert_peel_error(GIT_EINVALIDSPEC, "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_TAG);
assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_ANY,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE);
assert_peel_error(GIT_EINVALIDSPEC, "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_BLOB);
assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_TREE,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE);
assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT,
"e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT);
assert_peel_error(GIT_EINVALIDSPEC, "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_TAG);
assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_ANY,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE);
}
void test_object_peel__tree(void)
{
assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_BLOB);
assert_peel("53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE);
assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_COMMIT);
assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TAG);
assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_ANY);
assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_BLOB);
assert_peel("53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE);
assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_COMMIT);
assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TAG);
assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_ANY);
}
void test_object_peel__blob(void)
{
assert_peel("0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_BLOB,
"0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_BLOB);
assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_TREE);
assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_COMMIT);
assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_TAG);
assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_ANY);
assert_peel("0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_BLOB,
"0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_BLOB);
assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_TREE);
assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_COMMIT);
assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_TAG);
assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_ANY);
}
void test_object_peel__target_any_object_for_type_change(void)
{
/* tag to commit */
assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_ANY,
"e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT);
assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_ANY,
"e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT);
/* commit to tree */
assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_ANY,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE);
assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_ANY,
"53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE);
}
......@@ -277,47 +277,47 @@ static char *some_id = "fd8430bc864cfcd5f10e5590f8a447e01b942bfe";
static git_rawobj tree_obj = {
tree_data,
sizeof(tree_data),
GIT_OBJ_TREE
GIT_OBJECT_TREE
};
static git_rawobj tag_obj = {
tag_data,
sizeof(tag_data),
GIT_OBJ_TAG
GIT_OBJECT_TAG
};
static git_rawobj zero_obj = {
zero_data,
0,
GIT_OBJ_BLOB
GIT_OBJECT_BLOB
};
static git_rawobj one_obj = {
one_data,
sizeof(one_data),
GIT_OBJ_BLOB
GIT_OBJECT_BLOB
};
static git_rawobj two_obj = {
two_data,
sizeof(two_data),
GIT_OBJ_BLOB
GIT_OBJECT_BLOB
};
static git_rawobj commit_obj = {
commit_data,
sizeof(commit_data),
GIT_OBJ_COMMIT
GIT_OBJECT_COMMIT
};
static git_rawobj some_obj = {
some_data,
sizeof(some_data),
GIT_OBJ_BLOB
GIT_OBJECT_BLOB
};
static git_rawobj junk_obj = {
NULL,
0,
GIT_OBJ_BAD
GIT_OBJECT_BAD
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment