diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2018-12-01 12:13:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-01 12:13:19 +0000 |
commit | 788fccc40b28cea2e15bb7a0cafc706bb86d13c1 (patch) | |
tree | c6d07340e2d8d2d66091c44c7763f3e1823acca2 | |
parent | 0ddc60944ca4727246414e8bcf3170fe8286f854 (diff) | |
parent | 168fe39bea3368972a8b1a33d5908e73bc790c18 (diff) | |
download | libgit2-788fccc40b28cea2e15bb7a0cafc706bb86d13c1.tar.gz |
Merge pull request #4807 from libgit2/ethomson/index_fixes
Index API updates for consistency
145 files changed, 1032 insertions, 974 deletions
diff --git a/include/git2/common.h b/include/git2/common.h index 152e23aae..82f6ba48b 100644 --- a/include/git2/common.h +++ b/include/git2/common.h @@ -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) * diff --git a/include/git2/index.h b/include/git2/index.h index e43d6f857..9d73ce27c 100644 --- a/include/git2/index.h +++ b/include/git2/index.h @@ -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 diff --git a/include/git2/object.h b/include/git2/object.h index a798c9dc3..01dc37ace 100644 --- a/include/git2/object.h +++ b/include/git2/object.h @@ -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 diff --git a/include/git2/odb.h b/include/git2/odb.h index 006a75b7a..b752b9005 100644 --- a/include/git2/odb.h +++ b/include/git2/odb.h @@ -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 diff --git a/include/git2/refs.h b/include/git2/refs.h index 0dd453e55..ec67a8f95 100644 --- a/include/git2/refs.h +++ b/include/git2/refs.h @@ -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. diff --git a/include/git2/repository.h b/include/git2/repository.h index a39ebb99b..344c20316 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -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); /** diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h index 792f103fe..75341e8ab 100644 --- a/include/git2/sys/odb_backend.h +++ b/include/git2/sys/odb_backend.h @@ -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)( diff --git a/include/git2/tag.h b/include/git2/tag.h index cb95fb5ef..12683e4d1 100644 --- a/include/git2/tag.h +++ b/include/git2/tag.h @@ -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 diff --git a/include/git2/tree.h b/include/git2/tree.h index 1a363c149..e98a4c68e 100644 --- a/include/git2/tree.h +++ b/include/git2/tree.h @@ -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 diff --git a/include/git2/types.h b/include/git2/types.h index 3c127e3eb..2074ca934 100644 --- a/include/git2/types.h +++ b/include/git2/types.h @@ -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 diff --git a/src/annotated_commit.c b/src/annotated_commit.c index 1aa67dd52..3d982cbb4 100644 --- a/src/annotated_commit.c +++ b/src/annotated_commit.c @@ -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), diff --git a/src/blame.c b/src/blame.c index 7a81a232c..78b39886c 100644 --- a/src/blame.c +++ b/src/blame.c @@ -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; diff --git a/src/blame_git.c b/src/blame_git.c index 302cd1e23..552f3f35b 100644 --- a/src/blame_git.c +++ b/src/blame_git.c @@ -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)) diff --git a/src/blob.c b/src/blob.c index bcd3f41e1..ef8a004ae 100644 --- a/src/blob.c +++ b/src/blob.c @@ -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; } diff --git a/src/cache.c b/src/cache.c index 6f20ac001..d786104b2 100644 --- a/src/cache.c +++ b/src/cache.c @@ -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; diff --git a/src/cache.h b/src/cache.h index 9c09954ae..d2386eea6 100644 --- a/src/cache.h +++ b/src/cache.h @@ -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); diff --git a/src/checkout.c b/src/checkout.c index 2a4e5c4a5..a57e91924 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -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; diff --git a/src/cherrypick.c b/src/cherrypick.c index b61ce317f..ba404aca3 100644 --- a/src/cherrypick.c +++ b/src/cherrypick.c @@ -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 || diff --git a/src/commit.c b/src/commit.c index a26368ce0..3338b175d 100644 --- a/src/commit.c +++ b/src/commit.c @@ -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: diff --git a/src/commit_list.c b/src/commit_list.c index b4313eed2..078a87bc0 100644 --- a/src/commit_list.c +++ b/src/commit_list.c @@ -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 diff --git a/src/describe.c b/src/describe.c index d00f016d5..cf2c72841 100644 --- a/src/describe.c +++ b/src/describe.c @@ -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(¤t_id, repo, GIT_HEAD_FILE)) < 0) return error; - if ((error = git_object_lookup(&commit, repo, ¤t_id, GIT_OBJ_COMMIT)) < 0) + if ((error = git_object_lookup(&commit, repo, ¤t_id, GIT_OBJECT_COMMIT)) < 0) return error; /* The first step is to perform a describe of HEAD, so we can leverage this */ diff --git a/src/diff_file.c b/src/diff_file.c index b98995d21..b4ccec832 100644 --- a/src/diff_file.c +++ b/src/diff_file.c @@ -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; } diff --git a/src/diff_generate.c b/src/diff_generate.c index 539269a99..ffe6d80e1 100644 --- a/src/diff_generate.c +++ b/src/diff_generate.c @@ -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 */ diff --git a/src/diff_generate.h b/src/diff_generate.h index 3f182b0ba..6e669a3d5 100644 --- a/src/diff_generate.h +++ b/src/diff_generate.h @@ -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; diff --git a/src/diff_tform.c b/src/diff_tform.c index 42da15065..8c5abbf47 100644 --- a/src/diff_tform.c +++ b/src/diff_tform.c @@ -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); diff --git a/src/idxmap.c b/src/idxmap.c index 05a7b2feb..edf8fff5a 100644 --- a/src/idxmap.c +++ b/src/idxmap.c @@ -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) diff --git a/src/index.c b/src/index.c index a5a3478c2..e4f0338df 100644 --- a/src/index.c +++ b/src/index.c @@ -168,7 +168,7 @@ int git_index_entry_srch(const void *key, const void *array_member) return 1; if (srch_key->stage != GIT_INDEX_STAGE_ANY) - return srch_key->stage - GIT_IDXENTRY_STAGE(&entry->entry); + return srch_key->stage - GIT_INDEX_ENTRY_STAGE(&entry->entry); return 0; } @@ -194,7 +194,7 @@ int git_index_entry_isrch(const void *key, const void *array_member) return 1; if (srch_key->stage != GIT_INDEX_STAGE_ANY) - return srch_key->stage - GIT_IDXENTRY_STAGE(&entry->entry); + return srch_key->stage - GIT_INDEX_ENTRY_STAGE(&entry->entry); return 0; } @@ -222,7 +222,7 @@ int git_index_entry_cmp(const void *a, const void *b) diff = strcmp(entry_a->path, entry_b->path); if (diff == 0) - diff = (GIT_IDXENTRY_STAGE(entry_a) - GIT_IDXENTRY_STAGE(entry_b)); + diff = (GIT_INDEX_ENTRY_STAGE(entry_a) - GIT_INDEX_ENTRY_STAGE(entry_b)); return diff; } @@ -236,7 +236,7 @@ int git_index_entry_icmp(const void *a, const void *b) diff = strcasecmp(entry_a->path, entry_b->path); if (diff == 0) - diff = (GIT_IDXENTRY_STAGE(entry_a) - GIT_IDXENTRY_STAGE(entry_b)); + diff = (GIT_INDEX_ENTRY_STAGE(entry_a) - GIT_INDEX_ENTRY_STAGE(entry_b)); return diff; } @@ -562,7 +562,7 @@ int git_index_set_caps(git_index *index, int caps) old_ignore_case = index->ignore_case; - if (caps == GIT_INDEXCAP_FROM_OWNER) { + if (caps == GIT_INDEX_CAPABILITY_FROM_OWNER) { git_repository *repo = INDEX_OWNER(index); int val; @@ -578,9 +578,9 @@ int git_index_set_caps(git_index *index, int caps) index->no_symlinks = (val == 0); } else { - index->ignore_case = ((caps & GIT_INDEXCAP_IGNORE_CASE) != 0); - index->distrust_filemode = ((caps & GIT_INDEXCAP_NO_FILEMODE) != 0); - index->no_symlinks = ((caps & GIT_INDEXCAP_NO_SYMLINKS) != 0); + index->ignore_case = ((caps & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0); + index->distrust_filemode = ((caps & GIT_INDEX_CAPABILITY_NO_FILEMODE) != 0); + index->no_symlinks = ((caps & GIT_INDEX_CAPABILITY_NO_SYMLINKS) != 0); } if (old_ignore_case != index->ignore_case) { @@ -592,9 +592,9 @@ int git_index_set_caps(git_index *index, int caps) int git_index_caps(const git_index *index) { - return ((index->ignore_case ? GIT_INDEXCAP_IGNORE_CASE : 0) | - (index->distrust_filemode ? GIT_INDEXCAP_NO_FILEMODE : 0) | - (index->no_symlinks ? GIT_INDEXCAP_NO_SYMLINKS : 0)); + return ((index->ignore_case ? GIT_INDEX_CAPABILITY_IGNORE_CASE : 0) | + (index->distrust_filemode ? GIT_INDEX_CAPABILITY_NO_FILEMODE : 0) | + (index->no_symlinks ? GIT_INDEX_CAPABILITY_NO_SYMLINKS : 0)); } const git_oid *git_index_checksum(git_index *index) @@ -736,7 +736,7 @@ static int truncate_racily_clean(git_index *index) diff_opts.flags |= GIT_DIFF_INCLUDE_TYPECHANGE | GIT_DIFF_IGNORE_SUBMODULES | GIT_DIFF_DISABLE_PATHSPEC_MATCH; git_vector_foreach(&index->entries, i, entry) { - if ((entry->flags_extended & GIT_IDXENTRY_UPTODATE) == 0 && + if ((entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE) == 0 && is_racy_entry(index, entry)) git_vector_insert(&paths, (char *)entry->path); } @@ -857,7 +857,7 @@ const git_index_entry *git_index_get_bypath( assert(index); key.path = path; - GIT_IDXENTRY_STAGE_SET(&key, stage); + GIT_INDEX_ENTRY_STAGE_SET(&key, stage); LOOKUP_IN_MAP(pos, index, &key); @@ -890,12 +890,12 @@ static void index_entry_adjust_namemask( git_index_entry *entry, size_t path_length) { - entry->flags &= ~GIT_IDXENTRY_NAMEMASK; + entry->flags &= ~GIT_INDEX_ENTRY_NAMEMASK; - if (path_length < GIT_IDXENTRY_NAMEMASK) - entry->flags |= path_length & GIT_IDXENTRY_NAMEMASK; + if (path_length < GIT_INDEX_ENTRY_NAMEMASK) + entry->flags |= path_length & GIT_INDEX_ENTRY_NAMEMASK; else - entry->flags |= GIT_IDXENTRY_NAMEMASK; + entry->flags |= GIT_INDEX_ENTRY_NAMEMASK; } /* When `from_workdir` is true, we will validate the paths to avoid placing @@ -1078,7 +1078,7 @@ static void index_entry_cpy_nocache( git_oid_cpy(&tgt->id, &src->id); tgt->mode = src->mode; tgt->flags = src->flags; - tgt->flags_extended = (src->flags_extended & GIT_IDXENTRY_EXTENDED_FLAGS); + tgt->flags_extended = (src->flags_extended & GIT_INDEX_ENTRY_EXTENDED_FLAGS); } static int index_entry_dup_nocache( @@ -1097,7 +1097,7 @@ static int has_file_name(git_index *index, const git_index_entry *entry, size_t pos, int ok_to_replace) { size_t len = strlen(entry->path); - int stage = GIT_IDXENTRY_STAGE(entry); + int stage = GIT_INDEX_ENTRY_STAGE(entry); const char *name = entry->path; while (pos < index->entries.length) { @@ -1107,7 +1107,7 @@ static int has_file_name(git_index *index, break; if (memcmp(name, p->path, len)) break; - if (GIT_IDXENTRY_STAGE(&p->entry) != stage) + if (GIT_INDEX_ENTRY_STAGE(&p->entry) != stage) continue; if (p->path[len] != '/') continue; @@ -1127,7 +1127,7 @@ static int has_file_name(git_index *index, static int has_dir_name(git_index *index, const git_index_entry *entry, int ok_to_replace) { - int stage = GIT_IDXENTRY_STAGE(entry); + int stage = GIT_INDEX_ENTRY_STAGE(entry); const char *name = entry->path; const char *slash = name + strlen(name); @@ -1164,7 +1164,7 @@ static int has_dir_name(git_index *index, memcmp(p->path, name, len)) break; /* not our subdirectory */ - if (GIT_IDXENTRY_STAGE(&p->entry) == stage) + if (GIT_INDEX_ENTRY_STAGE(&p->entry) == stage) return 0; } } @@ -1222,7 +1222,7 @@ static int canonicalize_directory_path( &pos, &index->entries, index->entries_search_path, search); while ((match = git_vector_get(&index->entries, pos))) { - if (GIT_IDXENTRY_STAGE(match) != 0) { + if (GIT_INDEX_ENTRY_STAGE(match) != 0) { /* conflicts do not contribute to canonical paths */ } else if (strncmp(search, match->path, search_len) == 0) { /* prefer an exact match to the input filename */ @@ -1260,7 +1260,7 @@ static int index_no_dups(void **old, void *new) const git_index_entry *entry = new; GIT_UNUSED(old); giterr_set(GITERR_INDEX, "'%s' appears multiple times at stage %d", - entry->path, GIT_IDXENTRY_STAGE(entry)); + entry->path, GIT_INDEX_ENTRY_STAGE(entry)); return GIT_EEXISTS; } @@ -1276,7 +1276,7 @@ static void index_existing_and_best( int error; error = index_find(&pos, - index, entry->path, 0, GIT_IDXENTRY_STAGE(entry)); + index, entry->path, 0, GIT_INDEX_ENTRY_STAGE(entry)); if (error == 0) { *existing = index->entries.contents[pos]; @@ -1289,7 +1289,7 @@ static void index_existing_and_best( *existing_position = 0; *best = NULL; - if (GIT_IDXENTRY_STAGE(entry) == 0) { + if (GIT_INDEX_ENTRY_STAGE(entry) == 0) { for (; pos < index->entries.length; pos++) { int (*strcomp)(const char *a, const char *b) = index->ignore_case ? git__strcasecmp : git__strcmp; @@ -1299,7 +1299,7 @@ static void index_existing_and_best( if (strcomp(entry->path, e->path) != 0) break; - if (GIT_IDXENTRY_STAGE(e) == GIT_INDEX_STAGE_ANCESTOR) { + if (GIT_INDEX_ENTRY_STAGE(e) == GIT_INDEX_STAGE_ANCESTOR) { *best = e; continue; } else { @@ -1344,7 +1344,7 @@ static int index_insert( index_entry_adjust_namemask(entry, path_length); /* This entry is now up-to-date and should not be checked for raciness */ - entry->flags_extended |= GIT_IDXENTRY_UPTODATE; + entry->flags_extended |= GIT_INDEX_ENTRY_UPTODATE; git_vector_sort(&index->entries); @@ -1628,7 +1628,7 @@ int git_index__fill(git_index *index, const git_vector *source_entries) break; index_entry_adjust_namemask(entry, ((struct entry_internal *)entry)->pathlen); - entry->flags_extended |= GIT_IDXENTRY_UPTODATE; + entry->flags_extended |= GIT_INDEX_ENTRY_UPTODATE; entry->mode = git_index__create_mode(entry->mode); if ((ret = git_vector_insert(&index->entries, entry)) < 0) @@ -1675,7 +1675,7 @@ int git_index_remove(git_index *index, const char *path, int stage) git_index_entry remove_key = {{ 0 }}; remove_key.path = path; - GIT_IDXENTRY_STAGE_SET(&remove_key, stage); + GIT_INDEX_ENTRY_STAGE_SET(&remove_key, stage); DELETE_IN_MAP(index, &remove_key); @@ -1706,7 +1706,7 @@ int git_index_remove_directory(git_index *index, const char *dir, int stage) if (!entry || git__prefixcmp(entry->path, pfx.ptr) != 0) break; - if (GIT_IDXENTRY_STAGE(entry) != stage) { + if (GIT_INDEX_ENTRY_STAGE(entry) != stage) { ++pos; continue; } @@ -1822,7 +1822,7 @@ int git_index_conflict_add(git_index *index, continue; /* Make sure stage is correct */ - GIT_IDXENTRY_STAGE_SET(entries[i], i + 1); + GIT_INDEX_ENTRY_STAGE_SET(entries[i], i + 1); if ((ret = index_insert(index, &entries[i], 1, true, true, false)) < 0) goto on_error; @@ -1865,7 +1865,7 @@ static int index_conflict__get_byindex( if (path && index->entries_cmp_path(conflict_entry->path, path) != 0) break; - stage = GIT_IDXENTRY_STAGE(conflict_entry); + stage = GIT_INDEX_ENTRY_STAGE(conflict_entry); path = conflict_entry->path; switch (stage) { @@ -1932,7 +1932,7 @@ static int index_conflict_remove(git_index *index, const char *path) index->entries_cmp_path(conflict_entry->path, path) != 0) break; - if (GIT_IDXENTRY_STAGE(conflict_entry) == 0) { + if (GIT_INDEX_ENTRY_STAGE(conflict_entry) == 0) { pos++; continue; } @@ -1964,7 +1964,7 @@ int git_index_has_conflicts(const git_index *index) assert(index); git_vector_foreach(&index->entries, i, entry) { - if (GIT_IDXENTRY_STAGE(entry) > 0) + if (GIT_INDEX_ENTRY_STAGE(entry) > 0) return 1; } @@ -2386,13 +2386,13 @@ out_err: static size_t index_entry_size(size_t path_len, size_t varint_len, uint32_t flags) { if (varint_len) { - if (flags & GIT_IDXENTRY_EXTENDED) + if (flags & GIT_INDEX_ENTRY_EXTENDED) return offsetof(struct entry_long, path) + path_len + 1 + varint_len; else return offsetof(struct entry_short, path) + path_len + 1 + varint_len; } else { #define entry_size(type,len) ((offsetof(type, path) + (len) + 8) & ~7) - if (flags & GIT_IDXENTRY_EXTENDED) + if (flags & GIT_INDEX_ENTRY_EXTENDED) return entry_size(struct entry_long, path_len); else return entry_size(struct entry_short, path_len); @@ -2434,7 +2434,7 @@ static int read_entry( git_oid_cpy(&entry.id, &source.oid); entry.flags = ntohs(source.flags); - if (entry.flags & GIT_IDXENTRY_EXTENDED) { + if (entry.flags & GIT_INDEX_ENTRY_EXTENDED) { uint16_t flags_raw; size_t flags_offset; @@ -2449,7 +2449,7 @@ static int read_entry( path_ptr = (const char *) buffer + offsetof(struct entry_short, path); if (!compressed) { - path_length = entry.flags & GIT_IDXENTRY_NAMEMASK; + path_length = entry.flags & GIT_INDEX_ENTRY_NAMEMASK; /* if this is a very long string, we must find its * real length without overflowing */ @@ -2694,10 +2694,10 @@ static bool is_index_extended(git_index *index) extended = 0; git_vector_foreach(&index->entries, i, entry) { - entry->flags &= ~GIT_IDXENTRY_EXTENDED; - if (entry->flags_extended & GIT_IDXENTRY_EXTENDED_FLAGS) { + entry->flags &= ~GIT_INDEX_ENTRY_EXTENDED; + if (entry->flags_extended & GIT_INDEX_ENTRY_EXTENDED_FLAGS) { extended++; - entry->flags |= GIT_IDXENTRY_EXTENDED; + entry->flags |= GIT_INDEX_ENTRY_EXTENDED; } } @@ -2762,11 +2762,11 @@ static int write_disk_entry(git_filebuf *file, git_index_entry *entry, const cha ondisk.flags = htons(entry->flags); - if (entry->flags & GIT_IDXENTRY_EXTENDED) { + if (entry->flags & GIT_INDEX_ENTRY_EXTENDED) { struct entry_long ondisk_ext; memcpy(&ondisk_ext, &ondisk, sizeof(struct entry_short)); ondisk_ext.flags_extended = htons(entry->flags_extended & - GIT_IDXENTRY_EXTENDED_FLAGS); + GIT_INDEX_ENTRY_EXTENDED_FLAGS); memcpy(mem, &ondisk_ext, offsetof(struct entry_long, path)); path = ((struct entry_long*)mem)->path; disk_size -= offsetof(struct entry_long, path); @@ -2980,7 +2980,7 @@ static void clear_uptodate(git_index *index) size_t i; git_vector_foreach(&index->entries, i, entry) - entry->flags_extended &= ~GIT_IDXENTRY_UPTODATE; + entry->flags_extended &= ~GIT_INDEX_ENTRY_UPTODATE; } static int write_index(git_oid *checksum, git_index *index, git_filebuf *file) @@ -3037,12 +3037,12 @@ static int write_index(git_oid *checksum, git_index *index, git_filebuf *file) int git_index_entry_stage(const git_index_entry *entry) { - return GIT_IDXENTRY_STAGE(entry); + return GIT_INDEX_ENTRY_STAGE(entry); } int git_index_entry_is_conflict(const git_index_entry *entry) { - return (GIT_IDXENTRY_STAGE(entry) > 0); + return (GIT_INDEX_ENTRY_STAGE(entry) > 0); } typedef struct read_tree_data { diff --git a/src/indexer.c b/src/indexer.c index ecbee35df..dd9990423 100644 --- a/src/indexer.c +++ b/src/indexer.c @@ -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; } diff --git a/src/iterator.c b/src/iterator.c index dc7cfc7ad..b12c8ff0a 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -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; diff --git a/src/mailmap.c b/src/mailmap.c index 1f725b30d..ba4d4cec9 100644 --- a/src/mailmap.c +++ b/src/mailmap.c @@ -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; diff --git a/src/merge.c b/src/merge.c index 23a593cd8..754b08900 100644 --- a/src/merge.c +++ b/src/merge.c @@ -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 { diff --git a/src/object.c b/src/object.c index 87a8d1aae..ef7a4dd29 100644 --- a/src/object.c +++ b/src/object.c @@ -20,7 +20,7 @@ bool git_object__strict_input_validation = true; -extern int git_odb_hash(git_oid *out, const void *data, size_t len, git_otype type); +extern int git_odb_hash(git_oid *out, const void *data, size_t len, git_object_t type); typedef struct { const char *str; /* type name string */ @@ -32,26 +32,26 @@ typedef struct { } git_object_def; static git_object_def git_objects_table[] = { - /* 0 = GIT_OBJ__EXT1 */ + /* 0 = GIT_OBJECT__EXT1 */ { "", 0, NULL, NULL, NULL }, - /* 1 = GIT_OBJ_COMMIT */ + /* 1 = GIT_OBJECT_COMMIT */ { "commit", sizeof(git_commit), git_commit__parse, git_commit__parse_raw, git_commit__free }, - /* 2 = GIT_OBJ_TREE */ + /* 2 = GIT_OBJECT_TREE */ { "tree", sizeof(git_tree), git_tree__parse, git_tree__parse_raw, git_tree__free }, - /* 3 = GIT_OBJ_BLOB */ + /* 3 = GIT_OBJECT_BLOB */ { "blob", sizeof(git_blob), git_blob__parse, git_blob__parse_raw, git_blob__free }, - /* 4 = GIT_OBJ_TAG */ + /* 4 = GIT_OBJECT_TAG */ { "tag", sizeof(git_tag), git_tag__parse, git_tag__parse_raw, git_tag__free }, - /* 5 = GIT_OBJ__EXT2 */ + /* 5 = GIT_OBJECT__EXT2 */ { "", 0, NULL, NULL, NULL }, - /* 6 = GIT_OBJ_OFS_DELTA */ + /* 6 = GIT_OBJECT_OFS_DELTA */ { "OFS_DELTA", 0, NULL, NULL, NULL }, - /* 7 = GIT_OBJ_REF_DELTA */ + /* 7 = GIT_OBJECT_REF_DELTA */ { "REF_DELTA", 0, NULL, NULL, NULL }, }; @@ -59,7 +59,7 @@ int git_object__from_raw( git_object **object_out, const char *data, size_t size, - git_otype type) + git_object_t type) { git_object_def *def; git_object *object; @@ -70,7 +70,7 @@ int git_object__from_raw( *object_out = NULL; /* Validate type match */ - if (type != GIT_OBJ_BLOB && type != GIT_OBJ_TREE && type != GIT_OBJ_COMMIT && type != GIT_OBJ_TAG) { + if (type != GIT_OBJECT_BLOB && type != GIT_OBJECT_TREE && type != GIT_OBJECT_COMMIT && type != GIT_OBJECT_TAG) { giterr_set(GITERR_INVALID, "the requested type is invalid"); return GIT_ENOTFOUND; } @@ -106,7 +106,7 @@ 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 error; size_t object_size; @@ -117,7 +117,7 @@ int git_object__from_odb_object( *object_out = NULL; /* Validate type match */ - if (type != GIT_OBJ_ANY && type != odb_obj->cached.type) { + if (type != GIT_OBJECT_ANY && type != odb_obj->cached.type) { giterr_set(GITERR_INVALID, "the requested type does not match the type in the ODB"); return GIT_ENOTFOUND; @@ -151,7 +151,7 @@ int git_object__from_odb_object( void git_object__free(void *obj) { - git_otype type = ((git_object *)obj)->cached.type; + git_object_t type = ((git_object *)obj)->cached.type; if (type < 0 || ((size_t)type) >= ARRAY_SIZE(git_objects_table) || !git_objects_table[type].free) @@ -165,7 +165,7 @@ int git_object_lookup_prefix( git_repository *repo, const git_oid *id, size_t len, - git_otype type) + git_object_t type) { git_object *object = NULL; git_odb *odb = NULL; @@ -197,7 +197,7 @@ int git_object_lookup_prefix( if (cached->flags == GIT_CACHE_STORE_PARSED) { object = (git_object *)cached; - if (type != GIT_OBJ_ANY && type != object->cached.type) { + if (type != GIT_OBJECT_ANY && type != object->cached.type) { git_object_free(object); giterr_set(GITERR_INVALID, "the requested type does not match the type in ODB"); @@ -247,7 +247,7 @@ int git_object_lookup_prefix( return error; } -int git_object_lookup(git_object **object_out, git_repository *repo, const git_oid *id, git_otype type) { +int git_object_lookup(git_object **object_out, git_repository *repo, const git_oid *id, git_object_t type) { return git_object_lookup_prefix(object_out, repo, id, GIT_OID_HEXSZ, type); } @@ -265,7 +265,7 @@ const git_oid *git_object_id(const git_object *obj) return &obj->cached.oid; } -git_otype git_object_type(const git_object *obj) +git_object_t git_object_type(const git_object *obj) { assert(obj); return obj->cached.type; @@ -277,7 +277,7 @@ git_repository *git_object_owner(const git_object *obj) return obj->repo; } -const char *git_object_type2string(git_otype type) +const char *git_object_type2string(git_object_t type) { if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table)) return ""; @@ -285,30 +285,30 @@ const char *git_object_type2string(git_otype type) return git_objects_table[type].str; } -git_otype git_object_string2type(const char *str) +git_object_t git_object_string2type(const char *str) { if (!str) - return GIT_OBJ_BAD; + return GIT_OBJECT_BAD; return git_object_stringn2type(str, strlen(str)); } -git_otype git_object_stringn2type(const char *str, size_t len) +git_object_t git_object_stringn2type(const char *str, size_t len) { size_t i; if (!str || !len || !*str) - return GIT_OBJ_BAD; + return GIT_OBJECT_BAD; for (i = 0; i < ARRAY_SIZE(git_objects_table); i++) if (*git_objects_table[i].str && !git__prefixncmp(str, len, git_objects_table[i].str)) - return (git_otype)i; + return (git_object_t)i; - return GIT_OBJ_BAD; + return GIT_OBJECT_BAD; } -int git_object_typeisloose(git_otype type) +int git_object_typeisloose(git_object_t type) { if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table)) return 0; @@ -316,7 +316,7 @@ int git_object_typeisloose(git_otype type) return (git_objects_table[type].size > 0) ? 1 : 0; } -size_t git_object__size(git_otype type) +size_t git_object__size(git_object_t type) { if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table)) return 0; @@ -326,17 +326,17 @@ size_t git_object__size(git_otype type) static int dereference_object(git_object **dereferenced, git_object *obj) { - git_otype type = git_object_type(obj); + git_object_t type = git_object_type(obj); switch (type) { - case GIT_OBJ_COMMIT: + case GIT_OBJECT_COMMIT: return git_commit_tree((git_tree **)dereferenced, (git_commit*)obj); - case GIT_OBJ_TAG: + case GIT_OBJECT_TAG: return git_tag_target(dereferenced, (git_tag*)obj); - case GIT_OBJ_BLOB: - case GIT_OBJ_TREE: + case GIT_OBJECT_BLOB: + case GIT_OBJECT_TREE: return GIT_EPEEL; default: @@ -344,7 +344,7 @@ static int dereference_object(git_object **dereferenced, git_object *obj) } } -static int peel_error(int error, const git_oid *oid, git_otype type) +static int peel_error(int error, const git_oid *oid, git_object_t type) { const char *type_name; char hex_oid[GIT_OID_HEXSZ + 1]; @@ -355,28 +355,28 @@ static int peel_error(int error, const git_oid *oid, git_otype type) hex_oid[GIT_OID_HEXSZ] = '\0'; giterr_set(GITERR_OBJECT, "the git_object of id '%s' can not be " - "successfully peeled into a %s (git_otype=%i).", hex_oid, type_name, type); + "successfully peeled into a %s (git_object_t=%i).", hex_oid, type_name, type); return error; } -static int check_type_combination(git_otype type, git_otype target) +static int check_type_combination(git_object_t type, git_object_t target) { if (type == target) return 0; switch (type) { - case GIT_OBJ_BLOB: - case GIT_OBJ_TREE: + case GIT_OBJECT_BLOB: + case GIT_OBJECT_TREE: /* a blob or tree can never be peeled to anything but themselves */ return GIT_EINVALIDSPEC; break; - case GIT_OBJ_COMMIT: + case GIT_OBJECT_COMMIT: /* a commit can only be peeled to a tree */ - if (target != GIT_OBJ_TREE && target != GIT_OBJ_ANY) + if (target != GIT_OBJECT_TREE && target != GIT_OBJECT_ANY) return GIT_EINVALIDSPEC; break; - case GIT_OBJ_TAG: + case GIT_OBJECT_TAG: /* a tag may point to anything, so we let anything through */ break; default: @@ -389,18 +389,18 @@ static int check_type_combination(git_otype type, git_otype target) int git_object_peel( git_object **peeled, const git_object *object, - git_otype target_type) + git_object_t target_type) { git_object *source, *deref = NULL; int error; assert(object && peeled); - assert(target_type == GIT_OBJ_TAG || - target_type == GIT_OBJ_COMMIT || - target_type == GIT_OBJ_TREE || - target_type == GIT_OBJ_BLOB || - target_type == GIT_OBJ_ANY); + assert(target_type == GIT_OBJECT_TAG || + target_type == GIT_OBJECT_COMMIT || + target_type == GIT_OBJECT_TREE || + target_type == GIT_OBJECT_BLOB || + target_type == GIT_OBJECT_ANY); if ((error = check_type_combination(git_object_type(object), target_type)) < 0) return peel_error(error, git_object_id(object), target_type); @@ -420,7 +420,7 @@ int git_object_peel( return 0; } - if (target_type == GIT_OBJ_ANY && + if (target_type == GIT_OBJECT_ANY && git_object_type(deref) != git_object_type(object)) { *peeled = deref; @@ -453,7 +453,7 @@ int git_object_lookup_bypath( git_object **out, const git_object *treeish, const char *path, - git_otype type) + git_object_t type) { int error = -1; git_tree *tree = NULL; @@ -461,13 +461,13 @@ int git_object_lookup_bypath( assert(out && treeish && path); - if ((error = git_object_peel((git_object**)&tree, treeish, GIT_OBJ_TREE)) < 0 || + if ((error = git_object_peel((git_object**)&tree, treeish, GIT_OBJECT_TREE)) < 0 || (error = git_tree_entry_bypath(&entry, tree, path)) < 0) { goto cleanup; } - if (type != GIT_OBJ_ANY && git_tree_entry_type(entry) != type) + if (type != GIT_OBJECT_ANY && git_tree_entry_type(entry) != type) { giterr_set(GITERR_OBJECT, "object at path '%s' is not of the asked-for type %d", @@ -527,10 +527,10 @@ int git_object_short_id(git_buf *out, const git_object *obj) } 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_odb *odb; - git_otype actual_type; + git_object_t actual_type; size_t len; int error; @@ -541,7 +541,7 @@ bool git_object__is_valid( (error = git_odb_read_header(&len, &actual_type, odb, id)) < 0) return false; - if (expected_type != GIT_OBJ_ANY && expected_type != actual_type) { + if (expected_type != GIT_OBJECT_ANY && expected_type != actual_type) { giterr_set(GITERR_INVALID, "the requested type does not match the type in the ODB"); return false; diff --git a/src/object.h b/src/object.h index f5cbbf763..95a7e2c12 100644 --- a/src/object.h +++ b/src/object.h @@ -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; } } diff --git a/src/object_api.c b/src/object_api.c index 75efa4d10..d45abd5ce 100644 --- a/src/object_api.c +++ b/src/object_api.c @@ -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 */ diff --git a/src/odb_loose.c b/src/odb_loose.c index c37b1eda2..3c0ed674d 100644 --- a/src/odb_loose.c +++ b/src/odb_loose.c @@ -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; diff --git a/src/odb_mempack.c b/src/odb_mempack.c index 4e54735e9..1086859be 100644 --- a/src/odb_mempack.c +++ b/src/odb_mempack.c @@ -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; diff --git a/src/odb_pack.c b/src/odb_pack.c index 30d183a27..c2c5e79cb 100644 --- a/src/odb_pack.c +++ b/src/odb_pack.c @@ -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) diff --git a/src/pack-objects.c b/src/pack-objects.c index a67faba14..a57a6bb4c 100644 --- a/src/pack-objects.c +++ b/src/pack-objects.c @@ -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) diff --git a/src/pack-objects.h b/src/pack-objects.h index a931f3f86..53684a1ba 100644 --- a/src/pack-objects.h +++ b/src/pack-objects.h @@ -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; diff --git a/src/pack.c b/src/pack.c index 02916f687..4e963ecc8 100644 --- a/src/pack.c +++ b/src/pack.c @@ -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; diff --git a/src/pack.h b/src/pack.h index e1d8d040e..f21ad9fa3 100644 --- a/src/pack.h +++ b/src/pack.h @@ -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); diff --git a/src/push.c b/src/push.c index ea12210c7..0ba4d9830 100644 --- a/src/push.c +++ b/src/push.c @@ -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; diff --git a/src/reader.c b/src/reader.c index 9375ff3f5..d819bb495 100644 --- a/src/reader.c +++ b/src/reader.c @@ -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; } diff --git a/src/rebase.c b/src/rebase.c index 6503e5fc5..0846487f9 100644 --- a/src/rebase.c +++ b/src/rebase.c @@ -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, diff --git a/src/refdb_fs.c b/src/refdb_fs.c index 49fc292a9..958d5087c 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -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; /* diff --git a/src/refs.c b/src/refs.c index 933921099..ee2718d1b 100644 --- a/src/refs.c +++ b/src/refs.c @@ -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); diff --git a/src/repository.c b/src/repository.c index 2305bfef3..c6f7c2025 100644 --- a/src/repository.c +++ b/src/repository.c @@ -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(¤t, 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) diff --git a/src/reset.c b/src/reset.c index 01b0b212f..b8d69e748 100644 --- a/src/reset.c +++ b/src/reset.c @@ -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; diff --git a/src/revert.c b/src/revert.c index e4cbcf507..32c8a3910 100644 --- a/src/revert.c +++ b/src/revert.c @@ -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 || diff --git a/src/revparse.c b/src/revparse.c index df96f9d86..5d403b216 100644 --- a/src/revparse.c +++ b/src/revparse.c @@ -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; diff --git a/src/revwalk.c b/src/revwalk.c index 597e66634..f3442ae9d 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -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) { diff --git a/src/settings.c b/src/settings.c index 4565507dd..d71841acf 100644 --- a/src/settings.c +++ b/src/settings.c @@ -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; diff --git a/src/submodule.c b/src/submodule.c index 45cb95766..f52b65876 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -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; diff --git a/src/transports/local.c b/src/transports/local.c index b1522d1ec..64a16891f 100644 --- a/src/transports/local.c +++ b/src/transports/local.c @@ -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 { diff --git a/src/tree.c b/src/tree.c index 566e961d4..5a3045d89 100644 --- a/src/tree.c +++ b/src/tree.c @@ -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; diff --git a/tests/apply/apply_helpers.c b/tests/apply/apply_helpers.c index c182e0582..91cc51a71 100644 --- a/tests/apply/apply_helpers.c +++ b/tests/apply/apply_helpers.c @@ -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); diff --git a/tests/checkout/binaryunicode.c b/tests/checkout/binaryunicode.c index 27e70d3f1..5ba79213a 100644 --- a/tests/checkout/binaryunicode.c +++ b/tests/checkout/binaryunicode.c @@ -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); } diff --git a/tests/checkout/checkout_helpers.c b/tests/checkout/checkout_helpers.c index 144be6a38..cecee6aae 100644 --- a/tests/checkout/checkout_helpers.c +++ b/tests/checkout/checkout_helpers.c @@ -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)); diff --git a/tests/checkout/conflict.c b/tests/checkout/conflict.c index 6670b2ec7..914b3c2de 100644 --- a/tests/checkout/conflict.c +++ b/tests/checkout/conflict.c @@ -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); } diff --git a/tests/checkout/icase.c b/tests/checkout/icase.c index 4aa78a869..e6c640ef5 100644 --- a/tests/checkout/icase.c +++ b/tests/checkout/icase.c @@ -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)); diff --git a/tests/checkout/index.c b/tests/checkout/index.c index 65a121d76..a4c811b6f 100644 --- a/tests/checkout/index.c +++ b/tests/checkout/index.c @@ -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)); } diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c index 4008935d6..47ded0f7c 100644 --- a/tests/checkout/tree.c +++ b/tests/checkout/tree.c @@ -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); diff --git a/tests/checkout/typechange.c b/tests/checkout/typechange.c index 7299f8d33..708af5956 100644 --- a/tests/checkout/typechange.c +++ b/tests/checkout/typechange.c @@ -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: diff --git a/tests/cherrypick/workdir.c b/tests/cherrypick/workdir.c index e43bb0807..8f6644996 100644 --- a/tests/cherrypick/workdir.c +++ b/tests/cherrypick/workdir.c @@ -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)); diff --git a/tests/clone/nonetwork.c b/tests/clone/nonetwork.c index 9c3a1e510..8a8337c04 100644 --- a/tests/clone/nonetwork.c +++ b/tests/clone/nonetwork.c @@ -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)); diff --git a/tests/commit/parse.c b/tests/commit/parse.c index 47ec6ddbf..a5dcf8709 100644 --- a/tests/commit/parse.c +++ b/tests/commit/parse.c @@ -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); diff --git a/tests/diff/diff_helpers.c b/tests/diff/diff_helpers.c index 50752b203..fdedd89ca 100644 --- a/tests/diff/diff_helpers.c +++ b/tests/diff/diff_helpers.c @@ -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; } diff --git a/tests/diff/rename.c b/tests/diff/rename.c index 0ba9330ac..2166ea521 100644 --- a/tests/diff/rename.c +++ b/tests/diff/rename.c @@ -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)); diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c index dab6147b5..f42121ff8 100644 --- a/tests/diff/workdir.c +++ b/tests/diff/workdir.c @@ -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)); diff --git a/tests/filter/file.c b/tests/filter/file.c index 8f8a58527..521c01c02 100644 --- a/tests/filter/file.c +++ b/tests/filter/file.c @@ -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); diff --git a/tests/index/bypath.c b/tests/index/bypath.c index 34a7412a8..f911ffb51 100644 --- a/tests/index/bypath.c +++ b/tests/index/bypath.c @@ -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)); } diff --git a/tests/index/collision.c b/tests/index/collision.c index 699c985fe..18d2664f0 100644 --- a/tests/index/collision.c +++ b/tests/index/collision.c @@ -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)); } diff --git a/tests/index/conflicts.c b/tests/index/conflicts.c index 27fbe2b05..41d0e219c 100644 --- a/tests/index/conflicts.c +++ b/tests/index/conflicts.c @@ -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; diff --git a/tests/index/filemodes.c b/tests/index/filemodes.c index 4eadb2c34..f2ca4564b 100644 --- a/tests/index/filemodes.c +++ b/tests/index/filemodes.c @@ -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)); diff --git a/tests/index/names.c b/tests/index/names.c index 11d2c416a..369318b03 100644 --- a/tests/index/names.c +++ b/tests/index/names.c @@ -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)); diff --git a/tests/index/racy.c b/tests/index/racy.c index a15f0fc87..e08deaea3 100644 --- a/tests/index/racy.c +++ b/tests/index/racy.c @@ -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); diff --git a/tests/index/read_index.c b/tests/index/read_index.c index 2df7cc8eb..836c12b0e 100644 --- a/tests/index/read_index.c +++ b/tests/index/read_index.c @@ -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, diff --git a/tests/index/reuc.c b/tests/index/reuc.c index 1489ed13e..1f95c4136 100644 --- a/tests/index/reuc.c +++ b/tests/index/reuc.c @@ -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); diff --git a/tests/index/tests.c b/tests/index/tests.c index de57bd898..49ef8b2cb 100644 --- a/tests/index/tests.c +++ b/tests/index/tests.c @@ -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)); diff --git a/tests/iterator/index.c b/tests/iterator/index.c index 7de0d12c4..8c7efb253 100644 --- a/tests/iterator/index.c +++ b/tests/iterator/index.c @@ -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)); } diff --git a/tests/merge/trees/automerge.c b/tests/merge/trees/automerge.c index e16b829ee..e4efba51c 100644 --- a/tests/merge/trees/automerge.c +++ b/tests/merge/trees/automerge.c @@ -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); diff --git a/tests/merge/trees/commits.c b/tests/merge/trees/commits.c index 786a77a8b..79fba8ac5 100644 --- a/tests/merge/trees/commits.c +++ b/tests/merge/trees/commits.c @@ -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)); } diff --git a/tests/merge/workdir/dirty.c b/tests/merge/workdir/dirty.c index dd7267b61..6044bca43 100644 --- a/tests/merge/workdir/dirty.c +++ b/tests/merge/workdir/dirty.c @@ -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); diff --git a/tests/object/blob/fromstream.c b/tests/object/blob/fromstream.c index 34b9f58d1..60090b6e4 100644 --- a/tests/object/blob/fromstream.c +++ b/tests/object/blob/fromstream.c @@ -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); } diff --git a/tests/object/cache.c b/tests/object/cache.c index 680f23630..d3ec53ac2 100644 --- a/tests/object/cache.c +++ b/tests/object/cache.c @@ -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); diff --git a/tests/object/commit/parse.c b/tests/object/commit/parse.c index a99110f18..4ff1ad62a 100644 --- a/tests/object/commit/parse.c +++ b/tests/object/commit/parse.c @@ -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) diff --git a/tests/object/lookup.c b/tests/object/lookup.c index 536c415e7..2458537fc 100644 --- a/tests/object/lookup.c +++ b/tests/object/lookup.c @@ -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); diff --git a/tests/object/lookupbypath.c b/tests/object/lookupbypath.c index 15e79f6ec..f2257f556 100644 --- a/tests/object/lookupbypath.c +++ b/tests/object/lookupbypath.c @@ -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)); diff --git a/tests/object/peel.c b/tests/object/peel.c index 344885f1d..8be6e42d4 100644 --- a/tests/object/peel.c +++ b/tests/object/peel.c @@ -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); } diff --git a/tests/object/raw/data.h b/tests/object/raw/data.h index cf23819f1..07ace60fc 100644 --- a/tests/object/raw/data.h +++ b/tests/object/raw/data.h @@ -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 }; diff --git a/tests/object/raw/hash.c b/tests/object/raw/hash.c index ede31e145..830f1caa1 100644 --- a/tests/object/raw/hash.c +++ b/tests/object/raw/hash.c @@ -80,20 +80,23 @@ void test_object_raw_hash__hash_junk_data(void) junk_obj.data = some_data; hash_object_fail(&id, &junk_obj); - junk_obj.type = GIT_OBJ__EXT1; + junk_obj.type = 0; /* EXT1 */ hash_object_fail(&id, &junk_obj); - junk_obj.type = GIT_OBJ__EXT2; + junk_obj.type = 5; /* EXT2 */ hash_object_fail(&id, &junk_obj); - junk_obj.type = GIT_OBJ_OFS_DELTA; + junk_obj.type = GIT_OBJECT_OFS_DELTA; hash_object_fail(&id, &junk_obj); - junk_obj.type = GIT_OBJ_REF_DELTA; + junk_obj.type = GIT_OBJECT_REF_DELTA; + hash_object_fail(&id, &junk_obj); + + junk_obj.type = 42; hash_object_fail(&id, &junk_obj); /* data can be NULL only if len is zero: */ - junk_obj.type = GIT_OBJ_BLOB; + junk_obj.type = GIT_OBJECT_BLOB; junk_obj.data = NULL; hash_object_pass(&id, &junk_obj); cl_assert(git_oid_cmp(&id, &id_zero) == 0); diff --git a/tests/object/raw/type2string.c b/tests/object/raw/type2string.c index a3585487f..0c2070500 100644 --- a/tests/object/raw/type2string.c +++ b/tests/object/raw/type2string.c @@ -6,15 +6,15 @@ void test_object_raw_type2string__convert_type_to_string(void) { - cl_assert_equal_s(git_object_type2string(GIT_OBJ_BAD), ""); - cl_assert_equal_s(git_object_type2string(GIT_OBJ__EXT1), ""); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_COMMIT), "commit"); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_TREE), "tree"); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_BLOB), "blob"); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_TAG), "tag"); - cl_assert_equal_s(git_object_type2string(GIT_OBJ__EXT2), ""); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA"); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA"); + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_BAD), ""); + cl_assert_equal_s(git_object_type2string(0), ""); /* EXT1 */ + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_COMMIT), "commit"); + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_TREE), "tree"); + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_BLOB), "blob"); + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_TAG), "tag"); + cl_assert_equal_s(git_object_type2string(5), ""); /* EXT2 */ + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_OFS_DELTA), "OFS_DELTA"); + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_REF_DELTA), "REF_DELTA"); cl_assert_equal_s(git_object_type2string(-2), ""); cl_assert_equal_s(git_object_type2string(8), ""); @@ -23,30 +23,30 @@ void test_object_raw_type2string__convert_type_to_string(void) void test_object_raw_type2string__convert_string_to_type(void) { - cl_assert(git_object_string2type(NULL) == GIT_OBJ_BAD); - cl_assert(git_object_string2type("") == GIT_OBJ_BAD); - cl_assert(git_object_string2type("commit") == GIT_OBJ_COMMIT); - cl_assert(git_object_string2type("tree") == GIT_OBJ_TREE); - cl_assert(git_object_string2type("blob") == GIT_OBJ_BLOB); - cl_assert(git_object_string2type("tag") == GIT_OBJ_TAG); - cl_assert(git_object_string2type("OFS_DELTA") == GIT_OBJ_OFS_DELTA); - cl_assert(git_object_string2type("REF_DELTA") == GIT_OBJ_REF_DELTA); - - cl_assert(git_object_string2type("CoMmIt") == GIT_OBJ_BAD); - cl_assert(git_object_string2type("hohoho") == GIT_OBJ_BAD); + cl_assert(git_object_string2type(NULL) == GIT_OBJECT_BAD); + cl_assert(git_object_string2type("") == GIT_OBJECT_BAD); + cl_assert(git_object_string2type("commit") == GIT_OBJECT_COMMIT); + cl_assert(git_object_string2type("tree") == GIT_OBJECT_TREE); + cl_assert(git_object_string2type("blob") == GIT_OBJECT_BLOB); + cl_assert(git_object_string2type("tag") == GIT_OBJECT_TAG); + cl_assert(git_object_string2type("OFS_DELTA") == GIT_OBJECT_OFS_DELTA); + cl_assert(git_object_string2type("REF_DELTA") == GIT_OBJECT_REF_DELTA); + + cl_assert(git_object_string2type("CoMmIt") == GIT_OBJECT_BAD); + cl_assert(git_object_string2type("hohoho") == GIT_OBJECT_BAD); } void test_object_raw_type2string__check_type_is_loose(void) { - cl_assert(git_object_typeisloose(GIT_OBJ_BAD) == 0); - cl_assert(git_object_typeisloose(GIT_OBJ__EXT1) == 0); - cl_assert(git_object_typeisloose(GIT_OBJ_COMMIT) == 1); - cl_assert(git_object_typeisloose(GIT_OBJ_TREE) == 1); - cl_assert(git_object_typeisloose(GIT_OBJ_BLOB) == 1); - cl_assert(git_object_typeisloose(GIT_OBJ_TAG) == 1); - cl_assert(git_object_typeisloose(GIT_OBJ__EXT2) == 0); - cl_assert(git_object_typeisloose(GIT_OBJ_OFS_DELTA) == 0); - cl_assert(git_object_typeisloose(GIT_OBJ_REF_DELTA) == 0); + cl_assert(git_object_typeisloose(GIT_OBJECT_BAD) == 0); + cl_assert(git_object_typeisloose(0) == 0); /* EXT1 */ + cl_assert(git_object_typeisloose(GIT_OBJECT_COMMIT) == 1); + cl_assert(git_object_typeisloose(GIT_OBJECT_TREE) == 1); + cl_assert(git_object_typeisloose(GIT_OBJECT_BLOB) == 1); + cl_assert(git_object_typeisloose(GIT_OBJECT_TAG) == 1); + cl_assert(git_object_typeisloose(5) == 0); /* EXT2 */ + cl_assert(git_object_typeisloose(GIT_OBJECT_OFS_DELTA) == 0); + cl_assert(git_object_typeisloose(GIT_OBJECT_REF_DELTA) == 0); cl_assert(git_object_typeisloose(-2) == 0); cl_assert(git_object_typeisloose(8) == 0); diff --git a/tests/object/raw/write.c b/tests/object/raw/write.c index c7270e26a..a360f04c5 100644 --- a/tests/object/raw/write.c +++ b/tests/object/raw/write.c @@ -58,7 +58,7 @@ static void make_odb_dir(void) /* Standard test form */ -void test_body(object_data *d, git_rawobj *o) +void test_body(object_data *d, git_rawobj *o) { git_odb *db; git_oid id1, id2; @@ -146,7 +146,7 @@ void test_object_raw_write__loose_object(void) git_rawobj commit_obj = { commit_data, sizeof(commit_data), - GIT_OBJ_COMMIT + GIT_OBJECT_COMMIT }; test_body(&commit, &commit_obj); @@ -182,7 +182,7 @@ void test_object_raw_write__loose_tree(void) static git_rawobj tree_obj = { tree_data, sizeof(tree_data), - GIT_OBJ_TREE + GIT_OBJECT_TREE }; test_body(&tree, &tree_obj); @@ -224,7 +224,7 @@ void test_object_raw_write__loose_tag(void) static git_rawobj tag_obj = { tag_data, sizeof(tag_data), - GIT_OBJ_TAG + GIT_OBJECT_TAG }; @@ -246,7 +246,7 @@ void test_object_raw_write__zero_length(void) static git_rawobj zero_obj = { zero_data, 0, - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; test_body(&zero, &zero_obj); @@ -267,7 +267,7 @@ void test_object_raw_write__one_byte(void) static git_rawobj one_obj = { one_data, sizeof(one_data), - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; test_body(&one, &one_obj); @@ -288,7 +288,7 @@ void test_object_raw_write__two_byte(void) static git_rawobj two_obj = { two_data, sizeof(two_data), - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; test_body(&two, &two_obj); @@ -455,7 +455,7 @@ void test_object_raw_write__several_bytes(void) static git_rawobj some_obj = { some_data, sizeof(some_data), - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; test_body(&some, &some_obj); diff --git a/tests/object/shortid.c b/tests/object/shortid.c index 5c5990a6b..9b673efeb 100644 --- a/tests/object/shortid.c +++ b/tests/object/shortid.c @@ -20,28 +20,28 @@ void test_object_shortid__select(void) git_buf shorty = {0}; git_oid_fromstr(&full, "ce013625030ba8dba906f756967f9e9ca394464a"); - cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY)); cl_git_pass(git_object_short_id(&shorty, obj)); cl_assert_equal_i(7, shorty.size); cl_assert_equal_s("ce01362", shorty.ptr); git_object_free(obj); git_oid_fromstr(&full, "038d718da6a1ebbc6a7780a96ed75a70cc2ad6e2"); - cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY)); cl_git_pass(git_object_short_id(&shorty, obj)); cl_assert_equal_i(7, shorty.size); cl_assert_equal_s("038d718", shorty.ptr); git_object_free(obj); git_oid_fromstr(&full, "dea509d097ce692e167dfc6a48a7a280cc5e877e"); - cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY)); cl_git_pass(git_object_short_id(&shorty, obj)); cl_assert_equal_i(9, shorty.size); cl_assert_equal_s("dea509d09", shorty.ptr); git_object_free(obj); git_oid_fromstr(&full, "dea509d0b3cb8ee0650f6ca210bc83f4678851ba"); - cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY)); cl_git_pass(git_object_short_id(&shorty, obj)); cl_assert_equal_i(9, shorty.size); cl_assert_equal_s("dea509d0b", shorty.ptr); diff --git a/tests/object/tag/parse.c b/tests/object/tag/parse.c index f701f6b89..22535a025 100644 --- a/tests/object/tag/parse.c +++ b/tests/object/tag/parse.c @@ -14,8 +14,8 @@ static void assert_tag_parses(const char *data, size_t datalen, if (!datalen) datalen = strlen(data); - cl_git_pass(git_object__from_raw((git_object **) &tag, data, datalen, GIT_OBJ_TAG)); - cl_assert_equal_i(tag->type, GIT_OBJ_TAG); + cl_git_pass(git_object__from_raw((git_object **) &tag, data, datalen, GIT_OBJECT_TAG)); + cl_assert_equal_i(tag->type, GIT_OBJECT_TAG); if (expected_oid) { git_oid oid; @@ -54,7 +54,7 @@ static void assert_tag_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_TAG)); + cl_git_fail(git_object__from_raw(&object, data, datalen, GIT_OBJECT_TAG)); } void test_object_tag_parse__valid_tag_parses(void) diff --git a/tests/object/tag/peel.c b/tests/object/tag/peel.c index e2cd8d6a8..7456a8e17 100644 --- a/tests/object/tag/peel.c +++ b/tests/object/tag/peel.c @@ -28,7 +28,7 @@ void test_object_tag_peel__cleanup(void) static void retrieve_tag_from_oid(git_tag **tag_out, git_repository *repo, const char *sha) { git_oid oid; - + cl_git_pass(git_oid_fromstr(&oid, sha)); cl_git_pass(git_tag_lookup(tag_out, repo, &oid)); } @@ -38,7 +38,7 @@ void test_object_tag_peel__can_peel_to_a_commit(void) retrieve_tag_from_oid(&tag, repo, "7b4384978d2493e851f9cca7858815fac9b10980"); cl_git_pass(git_tag_peel(&target, tag)); - cl_assert(git_object_type(target) == GIT_OBJ_COMMIT); + cl_assert(git_object_type(target) == GIT_OBJECT_COMMIT); cl_git_pass(git_oid_streq(git_object_id(target), "e90810b8df3e80c413d903f631643c716887138d")); } @@ -47,7 +47,7 @@ void test_object_tag_peel__can_peel_several_nested_tags_to_a_commit(void) retrieve_tag_from_oid(&tag, repo, "b25fa35b38051e4ae45d4222e795f9df2e43f1d1"); cl_git_pass(git_tag_peel(&target, tag)); - cl_assert(git_object_type(target) == GIT_OBJ_COMMIT); + cl_assert(git_object_type(target) == GIT_OBJECT_COMMIT); cl_git_pass(git_oid_streq(git_object_id(target), "e90810b8df3e80c413d903f631643c716887138d")); } @@ -56,6 +56,6 @@ void test_object_tag_peel__can_peel_to_a_non_commit(void) retrieve_tag_from_oid(&tag, repo, "521d87c1ec3aef9824daf6d96cc0ae3710766d91"); cl_git_pass(git_tag_peel(&target, tag)); - cl_assert(git_object_type(target) == GIT_OBJ_BLOB); - cl_git_pass(git_oid_streq(git_object_id(target), "1385f264afb75a56a5bec74243be9b367ba4ca08")); + cl_assert(git_object_type(target) == GIT_OBJECT_BLOB); + cl_git_pass(git_oid_streq(git_object_id(target), "1385f264afb75a56a5bec74243be9b367ba4ca08")); } diff --git a/tests/object/tag/read.c b/tests/object/tag/read.c index e28056ec7..90ba58029 100644 --- a/tests/object/tag/read.c +++ b/tests/object/tag/read.c @@ -39,7 +39,7 @@ void test_object_tag_read__parse(void) cl_git_pass(git_tag_lookup(&tag1, g_repo, &id1)); cl_assert_equal_s(git_tag_name(tag1), "test"); - cl_assert(git_tag_target_type(tag1) == GIT_OBJ_TAG); + cl_assert(git_tag_target_type(tag1) == GIT_OBJECT_TAG); cl_git_pass(git_tag_target((git_object **)&tag2, tag1)); cl_assert(tag2 != NULL); @@ -132,7 +132,7 @@ void test_object_tag_read__without_tagger_nor_message(void) cl_git_pass(git_tag_lookup(&tag, repo, &id)); cl_assert_equal_s(git_tag_name(tag), "taggerless"); - cl_assert(git_tag_target_type(tag) == GIT_OBJ_COMMIT); + cl_assert(git_tag_target_type(tag) == GIT_OBJECT_COMMIT); cl_assert(tag->message == NULL); cl_assert(tag->tagger == NULL); @@ -170,7 +170,7 @@ void test_object_tag_read__extra_header_fields(void) cl_git_pass(git_repository_odb__weakptr(&odb, g_repo)); - cl_git_pass(git_odb_write(&id, odb, silly_tag, strlen(silly_tag), GIT_OBJ_TAG)); + cl_git_pass(git_odb_write(&id, odb, silly_tag, strlen(silly_tag), GIT_OBJECT_TAG)); cl_git_pass(git_tag_lookup(&tag, g_repo, &id)); cl_assert_equal_s("v1_0_1 release\n", git_tag_message(tag)); diff --git a/tests/object/tag/write.c b/tests/object/tag/write.c index 4c5080185..48c8bfd36 100644 --- a/tests/object/tag/write.c +++ b/tests/object/tag/write.c @@ -31,7 +31,7 @@ void test_object_tag_write__basic(void) git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); /* create signature */ cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60)); @@ -73,7 +73,7 @@ void test_object_tag_write__overwrite(void) git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); /* create signature */ cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60)); @@ -100,7 +100,7 @@ void test_object_tag_write__replace(void) git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/e90810b")); git_oid_cpy(&old_tag_id, git_reference_target(ref_tag)); @@ -136,7 +136,7 @@ void test_object_tag_write__lightweight(void) git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_tag_create_lightweight( &object_id, @@ -164,7 +164,7 @@ void test_object_tag_write__lightweight_over_existing(void) git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); cl_assert_equal_i(GIT_EEXISTS, git_tag_create_lightweight( &object_id, @@ -198,7 +198,7 @@ void test_object_tag_write__creating_with_an_invalid_name_returns_EINVALIDSPEC(v git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60)); @@ -230,7 +230,7 @@ void create_annotation(git_oid *tag_id, const char *name) cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60)); git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_tag_annotation_create(tag_id, g_repo, name, target, tagger, "boom!")); git_object_free(target); diff --git a/tests/object/tree/duplicateentries.c b/tests/object/tree/duplicateentries.c index 35dd383ec..c11ae0d3d 100644 --- a/tests/object/tree/duplicateentries.c +++ b/tests/object/tree/duplicateentries.c @@ -18,9 +18,9 @@ void test_object_tree_duplicateentries__cleanup(void) { * parent cf80f8de9f1185bf3a05f993f6121880dd0cfbc9 * author Ben Straub <bstraub@github.com> 1343755506 -0700 * committer Ben Straub <bstraub@github.com> 1343755506 -0700 - * + * * Change a file mode - * + * * diff --git a/a/b.txt b/a/b.txt * old mode 100644 * new mode 100755 @@ -69,7 +69,7 @@ static void two_blobs(git_treebuilder *bld) { git_oid oid; const git_tree_entry *entry; - + cl_git_pass(git_oid_fromstr(&oid, "a8233120f6ad708f843d861ce2b7228ec4e3dec6")); /* blob oid (README) */ @@ -89,7 +89,7 @@ static void one_blob_and_one_tree(git_treebuilder *bld) { git_oid oid; const git_tree_entry *entry; - + cl_git_pass(git_oid_fromstr(&oid, "a8233120f6ad708f843d861ce2b7228ec4e3dec6")); /* blob oid (README) */ @@ -111,7 +111,7 @@ void test_object_tree_duplicateentries__cannot_create_a_duplicate_entry_through_ tree_creator(&tid, two_blobs); tree_checker(&tid, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd", GIT_FILEMODE_BLOB); - + tree_creator(&tid, one_blob_and_one_tree); tree_checker(&tid, "4e0883eeeeebc1fb1735161cea82f7cb5fab7e63", GIT_FILEMODE_TREE); } @@ -126,17 +126,17 @@ static void add_fake_conflicts(git_index *index) ancestor_entry.path = "duplicate"; ancestor_entry.mode = GIT_FILEMODE_BLOB; - GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1); + GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1); git_oid_fromstr(&ancestor_entry.id, "a8233120f6ad708f843d861ce2b7228ec4e3dec6"); our_entry.path = "duplicate"; our_entry.mode = GIT_FILEMODE_BLOB; - GIT_IDXENTRY_STAGE_SET(&our_entry, 2); + GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 2); git_oid_fromstr(&our_entry.id, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057"); their_entry.path = "duplicate"; their_entry.mode = GIT_FILEMODE_BLOB; - GIT_IDXENTRY_STAGE_SET(&their_entry, 3); + GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 3); git_oid_fromstr(&their_entry.id, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"); cl_git_pass(git_index_conflict_add(index, &ancestor_entry, &our_entry, &their_entry)); @@ -149,7 +149,7 @@ void test_object_tree_duplicateentries__cannot_create_a_duplicate_entry_building cl_git_pass(git_repository_index(&index, _repo)); - add_fake_conflicts(index); + add_fake_conflicts(index); cl_assert_equal_i(GIT_EUNMERGED, git_index_write_tree(&tid, index)); diff --git a/tests/object/tree/parse.c b/tests/object/tree/parse.c index 83d22193d..1ab01c820 100644 --- a/tests/object/tree/parse.c +++ b/tests/object/tree/parse.c @@ -26,7 +26,7 @@ static void assert_tree_parses(const char *data, size_t datalen, if (!datalen) datalen = strlen(data); - cl_git_pass(git_object__from_raw((git_object **) &tree, data, datalen, GIT_OBJ_TREE)); + cl_git_pass(git_object__from_raw((git_object **) &tree, data, datalen, GIT_OBJECT_TREE)); cl_assert_equal_i(git_tree_entrycount(tree), expected_nentries); @@ -51,7 +51,7 @@ static void assert_tree_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_TREE)); + cl_git_fail(git_object__from_raw(&object, data, datalen, GIT_OBJECT_TREE)); } void test_object_tree_parse__single_blob_parses(void) diff --git a/tests/object/tree/read.c b/tests/object/tree/read.c index 1d3a9133d..a0eae11d1 100644 --- a/tests/object/tree/read.c +++ b/tests/object/tree/read.c @@ -55,11 +55,11 @@ void test_object_tree_read__two(void) cl_assert(git_tree_entrycount(tree) == 3); /* GH-86: git_object_lookup() should also check the type if the object comes from the cache */ - cl_assert(git_object_lookup(&obj, g_repo, &id, GIT_OBJ_TREE) == 0); + cl_assert(git_object_lookup(&obj, g_repo, &id, GIT_OBJECT_TREE) == 0); cl_assert(obj != NULL); git_object_free(obj); obj = NULL; - cl_git_fail(git_object_lookup(&obj, g_repo, &id, GIT_OBJ_BLOB)); + cl_git_fail(git_object_lookup(&obj, g_repo, &id, GIT_OBJECT_BLOB)); cl_assert(obj == NULL); entry = git_tree_entry_byname(tree, "README"); diff --git a/tests/object/tree/walk.c b/tests/object/tree/walk.c index f8005e579..d1fdaa3a0 100644 --- a/tests/object/tree/walk.c +++ b/tests/object/tree/walk.c @@ -118,7 +118,7 @@ static int treewalk_skip_de_cb( GIT_UNUSED(root); - if (git_tree_entry_type(entry) == GIT_OBJ_TREE) + if (git_tree_entry_type(entry) == GIT_OBJECT_TREE) data->dirs++; else data->files++; diff --git a/tests/odb/backend/backend_helpers.c b/tests/odb/backend/backend_helpers.c index 37a8fd200..c0f4103f1 100644 --- a/tests/odb/backend/backend_helpers.c +++ b/tests/odb/backend/backend_helpers.c @@ -58,7 +58,7 @@ static int fake_backend__exists_prefix( } static int fake_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) { const fake_object *obj; @@ -74,13 +74,13 @@ static int fake_backend__read( *len_p = strlen(obj->content); *buffer_p = git__strdup(obj->content); - *type_p = GIT_OBJ_BLOB; + *type_p = GIT_OBJECT_BLOB; return 0; } static int fake_backend__read_header( - size_t *len_p, git_otype *type_p, + size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid) { const fake_object *obj; @@ -95,13 +95,13 @@ static int fake_backend__read_header( return error; *len_p = strlen(obj->content); - *type_p = GIT_OBJ_BLOB; + *type_p = GIT_OBJECT_BLOB; return 0; } static int fake_backend__read_prefix( - git_oid *out_oid, void **buffer_p, size_t *len_p, git_otype *type_p, + git_oid *out_oid, void **buffer_p, size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *short_oid, size_t len) { const fake_object *obj; @@ -118,7 +118,7 @@ static int fake_backend__read_prefix( git_oid_fromstr(out_oid, obj->oid); *len_p = strlen(obj->content); *buffer_p = git__strdup(obj->content); - *type_p = GIT_OBJ_BLOB; + *type_p = GIT_OBJECT_BLOB; return 0; } diff --git a/tests/odb/backend/mempack.c b/tests/odb/backend/mempack.c index 624f0e604..55cd69f80 100644 --- a/tests/odb/backend/mempack.c +++ b/tests/odb/backend/mempack.c @@ -28,7 +28,7 @@ void test_odb_backend_mempack__cleanup(void) void test_odb_backend_mempack__write_succeeds(void) { const char *data = "data"; - cl_git_pass(git_odb_write(&_oid, _odb, data, strlen(data) + 1, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&_oid, _odb, data, strlen(data) + 1, GIT_OBJECT_BLOB)); cl_git_pass(git_odb_read(&_obj, _odb, &_oid)); } @@ -47,7 +47,7 @@ void test_odb_backend_mempack__exists_of_missing_object_fails(void) void test_odb_backend_mempack__exists_with_existing_objects_succeeds(void) { const char *data = "data"; - cl_git_pass(git_odb_write(&_oid, _odb, data, strlen(data) + 1, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&_oid, _odb, data, strlen(data) + 1, GIT_OBJECT_BLOB)); cl_assert(git_odb_exists(_odb, &_oid) == 1); } diff --git a/tests/odb/backend/nobackend.c b/tests/odb/backend/nobackend.c index 3c4f344b1..cd727b7c4 100644 --- a/tests/odb/backend/nobackend.c +++ b/tests/odb/backend/nobackend.c @@ -37,7 +37,7 @@ void test_odb_backend_nobackend__write_fails_gracefully(void) const git_error *err; git_repository_odb(&odb, _repo); - cl_git_fail(git_odb_write(&id, odb, "Hello world!\n", 13, GIT_OBJ_BLOB)); + cl_git_fail(git_odb_write(&id, odb, "Hello world!\n", 13, GIT_OBJECT_BLOB)); err = giterr_last(); cl_assert_equal_s(err->message, "cannot write object - unsupported in the loaded odb backends"); diff --git a/tests/odb/backend/nonrefreshing.c b/tests/odb/backend/nonrefreshing.c index 6abc0c6d2..ede48ade6 100644 --- a/tests/odb/backend/nonrefreshing.c +++ b/tests/odb/backend/nonrefreshing.c @@ -58,7 +58,7 @@ void test_odb_backend_nonrefreshing__read_is_invoked_once_on_failure(void) git_object *obj; cl_git_fail_with( - git_object_lookup(&obj, _repo, &_nonexisting_oid, GIT_OBJ_ANY), + git_object_lookup(&obj, _repo, &_nonexisting_oid, GIT_OBJECT_ANY), GIT_ENOTFOUND); cl_assert_equal_i(1, _fake->read_calls); @@ -69,7 +69,7 @@ void test_odb_backend_nonrefreshing__readprefix_is_invoked_once_on_failure(void) git_object *obj; cl_git_fail_with( - git_object_lookup_prefix(&obj, _repo, &_nonexisting_oid, 7, GIT_OBJ_ANY), + git_object_lookup_prefix(&obj, _repo, &_nonexisting_oid, 7, GIT_OBJECT_ANY), GIT_ENOTFOUND); cl_assert_equal_i(1, _fake->read_prefix_calls); @@ -79,7 +79,7 @@ void test_odb_backend_nonrefreshing__readheader_is_invoked_once_on_failure(void) { git_odb *odb; size_t len; - git_otype type; + git_object_t type; cl_git_pass(git_repository_odb__weakptr(&odb, _repo)); @@ -104,7 +104,7 @@ void test_odb_backend_nonrefreshing__read_is_invoked_once_on_success(void) { git_object *obj; - cl_git_pass(git_object_lookup(&obj, _repo, &_existing_oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, _repo, &_existing_oid, GIT_OBJECT_ANY)); cl_assert_equal_i(1, _fake->read_calls); @@ -115,7 +115,7 @@ void test_odb_backend_nonrefreshing__readprefix_is_invoked_once_on_success(void) { git_object *obj; - cl_git_pass(git_object_lookup_prefix(&obj, _repo, &_existing_oid, 7, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup_prefix(&obj, _repo, &_existing_oid, 7, GIT_OBJECT_ANY)); cl_assert_equal_i(1, _fake->read_prefix_calls); @@ -126,7 +126,7 @@ void test_odb_backend_nonrefreshing__readheader_is_invoked_once_on_success(void) { git_odb *odb; size_t len; - git_otype type; + git_object_t type; cl_git_pass(git_repository_odb__weakptr(&odb, _repo)); diff --git a/tests/odb/emptyobjects.c b/tests/odb/emptyobjects.c index 61bb2b82c..89b22ad4a 100644 --- a/tests/odb/emptyobjects.c +++ b/tests/odb/emptyobjects.c @@ -27,7 +27,7 @@ void test_odb_emptyobjects__blob_notfound(void) cl_git_pass(git_oid_fromstr(&id, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391")); cl_git_fail_with(GIT_ENOTFOUND, git_blob_lookup(&blob, g_repo, &id)); - cl_git_pass(git_odb_write(&written_id, g_odb, "", 0, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&written_id, g_odb, "", 0, GIT_OBJECT_BLOB)); cl_assert(git_path_exists(TEST_REPO_PATH "/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391")); } @@ -38,7 +38,7 @@ void test_odb_emptyobjects__read_tree(void) cl_git_pass(git_oid_fromstr(&id, "4b825dc642cb6eb9a060e54bf8d69288fbee4904")); cl_git_pass(git_tree_lookup(&tree, g_repo, &id)); - cl_assert_equal_i(GIT_OBJ_TREE, git_object_type((git_object *) tree)); + cl_assert_equal_i(GIT_OBJECT_TREE, git_object_type((git_object *) tree)); cl_assert_equal_i(0, git_tree_entrycount(tree)); cl_assert_equal_p(NULL, git_tree_entry_byname(tree, "foo")); git_tree_free(tree); diff --git a/tests/odb/foreach.c b/tests/odb/foreach.c index 5db66ba27..3e44f10bb 100644 --- a/tests/odb/foreach.c +++ b/tests/odb/foreach.c @@ -98,7 +98,7 @@ void test_odb_foreach__interrupt_foreach(void) cl_git_pass(git_repository_init(&_repo, "onlyloose.git", true)); git_repository_odb(&_odb, _repo); - cl_git_pass(git_odb_write(&id, _odb, "", 0, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&id, _odb, "", 0, GIT_OBJECT_BLOB)); cl_assert_equal_i(-123, git_odb_foreach(_odb, foreach_stop_first_cb, &nobj)); } diff --git a/tests/odb/freshen.c b/tests/odb/freshen.c index 63541260e..1fe64309d 100644 --- a/tests/odb/freshen.c +++ b/tests/odb/freshen.c @@ -160,7 +160,7 @@ void test_odb_freshen__packed_object(void) /* ensure that packfile is freshened */ cl_git_pass(git_odb_write(&id, odb, PACKED_STR, - CONST_STRLEN(PACKED_STR), GIT_OBJ_BLOB)); + CONST_STRLEN(PACKED_STR), GIT_OBJECT_BLOB)); cl_assert_equal_oid(&expected_id, &id); cl_must_pass(p_lstat("testrepo.git/objects/pack/" PACKED_FN, &after)); @@ -171,7 +171,7 @@ void test_odb_freshen__packed_object(void) /* ensure that the pack file is not freshened again immediately */ cl_git_pass(git_odb_write(&id, odb, PACKED_STR, - CONST_STRLEN(PACKED_STR), GIT_OBJ_BLOB)); + CONST_STRLEN(PACKED_STR), GIT_OBJECT_BLOB)); cl_assert_equal_oid(&expected_id, &id); cl_must_pass(p_lstat("testrepo.git/objects/pack/" PACKED_FN, &after)); diff --git a/tests/odb/largefiles.c b/tests/odb/largefiles.c index 9fd99e520..8be2cfd02 100644 --- a/tests/odb/largefiles.c +++ b/tests/odb/largefiles.c @@ -29,7 +29,7 @@ static void writefile(git_oid *oid) for (i = 0; i < 3041; i++) cl_git_pass(git_buf_puts(&buf, "Hello, world.\n")); - cl_git_pass(git_odb_open_wstream(&stream, odb, LARGEFILE_SIZE, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_open_wstream(&stream, odb, LARGEFILE_SIZE, GIT_OBJECT_BLOB)); for (i = 0; i < 126103; i++) cl_git_pass(git_odb_stream_write(stream, buf.ptr, buf.size)); @@ -58,7 +58,7 @@ void test_odb_largefiles__write_from_memory(void) cl_git_pass(git_buf_puts(&buf, "Hello, world.\n")); git_oid_fromstr(&expected, "3fb56989cca483b21ba7cb0a6edb229d10e1c26c"); - cl_git_pass(git_odb_write(&oid, odb, buf.ptr, buf.size, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&oid, odb, buf.ptr, buf.size, GIT_OBJECT_BLOB)); cl_assert_equal_oid(&expected, &oid); } @@ -89,7 +89,7 @@ void test_odb_largefiles__streamread(void) char hdr[64]; size_t len, hdr_len, total = 0; git_hash_ctx hash; - git_otype type; + git_object_t type; int ret; #ifndef GIT_ARCH_64 @@ -105,7 +105,7 @@ void test_odb_largefiles__streamread(void) cl_git_pass(git_odb_open_rstream(&stream, &len, &type, odb, &oid)); cl_assert_equal_sz(LARGEFILE_SIZE, len); - cl_assert_equal_i(GIT_OBJ_BLOB, type); + cl_assert_equal_i(GIT_OBJECT_BLOB, type); cl_git_pass(git_hash_ctx_init(&hash)); cl_git_pass(git_odb__format_object_header(&hdr_len, hdr, sizeof(hdr), len, type)); @@ -171,7 +171,7 @@ void test_odb_largefiles__read_header(void) { git_oid oid; size_t len; - git_otype type; + git_object_t type; #ifndef GIT_ARCH_64 cl_skip(); @@ -185,5 +185,5 @@ void test_odb_largefiles__read_header(void) cl_git_pass(git_odb_read_header(&len, &type, odb, &oid)); cl_assert_equal_sz(LARGEFILE_SIZE, len); - cl_assert_equal_i(GIT_OBJ_BLOB, type); + cl_assert_equal_i(GIT_OBJECT_BLOB, type); } diff --git a/tests/odb/loose.c b/tests/odb/loose.c index 83d080729..5cf567cc2 100644 --- a/tests/odb/loose.c +++ b/tests/odb/loose.c @@ -60,7 +60,7 @@ static void test_read_header(object_data *data) git_oid id; git_odb *odb; size_t len; - git_otype type; + git_object_t type; write_object_files(data); @@ -212,7 +212,7 @@ void test_write_object_permission( cl_git_pass(git_odb_new(&odb)); cl_git_pass(git_odb_backend_loose(&backend, "test-objects", -1, 0, dir_mode, file_mode)); cl_git_pass(git_odb_add_backend(odb, backend, 1)); - cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJECT_BLOB)); cl_git_pass(p_stat("test-objects/67", &statbuf)); cl_assert_equal_i(statbuf.st_mode & os_mask, (expected_dir_mode & ~mask) & os_mask); @@ -247,7 +247,7 @@ static void write_object_to_loose_odb(int fsync) cl_git_pass(git_odb_new(&odb)); cl_git_pass(git_odb_backend_loose(&backend, "test-objects", -1, fsync, 0777, 0666)); cl_git_pass(git_odb_add_backend(odb, backend, 1)); - cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJECT_BLOB)); git_odb_free(odb); } @@ -278,14 +278,14 @@ void test_odb_loose__fsync_obeys_repo_setting(void) cl_git_pass(git_repository_init(&repo, "test-objects", 1)); cl_git_pass(git_repository_odb__weakptr(&odb, repo)); - cl_git_pass(git_odb_write(&oid, odb, "No fsync here\n", 14, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&oid, odb, "No fsync here\n", 14, GIT_OBJECT_BLOB)); cl_assert(p_fsync__cnt == 0); git_repository_free(repo); cl_git_pass(git_repository_open(&repo, "test-objects")); cl_repo_set_bool(repo, "core.fsyncObjectFiles", true); cl_git_pass(git_repository_odb__weakptr(&odb, repo)); - cl_git_pass(git_odb_write(&oid, odb, "Now fsync\n", 10, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&oid, odb, "Now fsync\n", 10, GIT_OBJECT_BLOB)); cl_assert(p_fsync__cnt > 0); git_repository_free(repo); } diff --git a/tests/odb/mixed.c b/tests/odb/mixed.c index 515eadfde..ba2b2acb7 100644 --- a/tests/odb/mixed.c +++ b/tests/odb/mixed.c @@ -112,46 +112,46 @@ void test_odb_mixed__dup_oid_prefix_0(void) { struct expand_id_test_data { char *lookup_id; char *expected_id; - git_otype expected_type; + git_object_t expected_type; }; struct expand_id_test_data expand_id_test_data[] = { /* some prefixes and their expected values */ - { "dea509d0", NULL, GIT_OBJ_ANY }, - { "00000000", NULL, GIT_OBJ_ANY }, - { "dea509d0", NULL, GIT_OBJ_ANY }, - { "dea509d09", "dea509d097ce692e167dfc6a48a7a280cc5e877e", GIT_OBJ_BLOB }, - { "dea509d0b", "dea509d0b3cb8ee0650f6ca210bc83f4678851ba", GIT_OBJ_BLOB }, - { "ce0136250", "ce013625030ba8dba906f756967f9e9ca394464a", GIT_OBJ_BLOB }, - { "0ddeaded", NULL, GIT_OBJ_ANY }, - { "4d5979b", "4d5979b468252190cb572ae758aca36928e8a91e", GIT_OBJ_TREE }, - { "0ddeaded", NULL, GIT_OBJ_ANY }, - { "0ddeadede", "0ddeadede9e6d6ccddce0ee1e5749eed0485e5ea", GIT_OBJ_BLOB }, - { "0ddeaded9", "0ddeaded9502971eefe1e41e34d0e536853ae20f", GIT_OBJ_BLOB }, - { "f00b4e", NULL, GIT_OBJ_ANY }, + { "dea509d0", NULL, GIT_OBJECT_ANY }, + { "00000000", NULL, GIT_OBJECT_ANY }, + { "dea509d0", NULL, GIT_OBJECT_ANY }, + { "dea509d09", "dea509d097ce692e167dfc6a48a7a280cc5e877e", GIT_OBJECT_BLOB }, + { "dea509d0b", "dea509d0b3cb8ee0650f6ca210bc83f4678851ba", GIT_OBJECT_BLOB }, + { "ce0136250", "ce013625030ba8dba906f756967f9e9ca394464a", GIT_OBJECT_BLOB }, + { "0ddeaded", NULL, GIT_OBJECT_ANY }, + { "4d5979b", "4d5979b468252190cb572ae758aca36928e8a91e", GIT_OBJECT_TREE }, + { "0ddeaded", NULL, GIT_OBJECT_ANY }, + { "0ddeadede", "0ddeadede9e6d6ccddce0ee1e5749eed0485e5ea", GIT_OBJECT_BLOB }, + { "0ddeaded9", "0ddeaded9502971eefe1e41e34d0e536853ae20f", GIT_OBJECT_BLOB }, + { "f00b4e", NULL, GIT_OBJECT_ANY }, /* this OID is too short and should be ambiguous! */ - { "f00", NULL, GIT_OBJ_ANY }, + { "f00", NULL, GIT_OBJECT_ANY }, /* some full-length object ids */ - { "0000000000000000000000000000000000000000", NULL, GIT_OBJ_ANY }, + { "0000000000000000000000000000000000000000", NULL, GIT_OBJECT_ANY }, { "dea509d097ce692e167dfc6a48a7a280cc5e877e", "dea509d097ce692e167dfc6a48a7a280cc5e877e", - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }, - { "f00f00f00f00f00f00f00f00f00f00f00f00f00f", NULL, GIT_OBJ_ANY }, + { "f00f00f00f00f00f00f00f00f00f00f00f00f00f", NULL, GIT_OBJECT_ANY }, { "4d5979b468252190cb572ae758aca36928e8a91e", "4d5979b468252190cb572ae758aca36928e8a91e", - GIT_OBJ_TREE + GIT_OBJECT_TREE }, /* * ensure we're not leaking the return error code for the * last lookup if the last object is invalid */ - { "0ddeadedfff", NULL, GIT_OBJ_ANY }, + { "0ddeadedfff", NULL, GIT_OBJECT_ANY }, }; static void setup_prefix_query( @@ -188,7 +188,7 @@ static void assert_found_objects(git_odb_expand_id *ids) for (i = 0; i < num; i++) { git_oid expected_id = {{0}}; size_t expected_len = 0; - git_otype expected_type = 0; + git_object_t expected_type = 0; if (expand_id_test_data[i].expected_id) { git_oid_fromstr(&expected_id, expand_id_test_data[i].expected_id); @@ -239,12 +239,12 @@ void test_odb_mixed__expand_ids(void) assert_found_objects(ids); git__free(ids); - /* test looking for an explicit GIT_OBJ_ANY */ + /* test looking for an explicit GIT_OBJECT_ANY */ setup_prefix_query(&ids, &num); for (i = 0; i < num; i++) - ids[i].type = GIT_OBJ_ANY; + ids[i].type = GIT_OBJECT_ANY; cl_git_pass(git_odb_expand_ids(_odb, ids, num)); assert_found_objects(ids); @@ -255,8 +255,8 @@ void test_odb_mixed__expand_ids(void) setup_prefix_query(&ids, &num); for (i = 0; i < num; i++) - ids[i].type = (ids[i].type == GIT_OBJ_BLOB) ? - GIT_OBJ_TREE : GIT_OBJ_BLOB; + ids[i].type = (ids[i].type == GIT_OBJECT_BLOB) ? + GIT_OBJECT_TREE : GIT_OBJECT_BLOB; cl_git_pass(git_odb_expand_ids(_odb, ids, num)); assert_notfound_objects(ids); diff --git a/tests/odb/packed.c b/tests/odb/packed.c index b4f549b58..3d502ed6d 100644 --- a/tests/odb/packed.c +++ b/tests/odb/packed.c @@ -39,7 +39,7 @@ void test_odb_packed__read_header_0(void) git_oid id; git_odb_object *obj; size_t len; - git_otype type; + git_object_t type; cl_git_pass(git_oid_fromstr(&id, packed_objects[i])); @@ -61,7 +61,7 @@ void test_odb_packed__read_header_1(void) git_oid id; git_odb_object *obj; size_t len; - git_otype type; + git_object_t type; cl_git_pass(git_oid_fromstr(&id, loose_objects[i])); diff --git a/tests/odb/packed_one.c b/tests/odb/packed_one.c index 0c6ed387b..17cd4f760 100644 --- a/tests/odb/packed_one.c +++ b/tests/odb/packed_one.c @@ -45,7 +45,7 @@ void test_odb_packed_one__read_header_0(void) git_oid id; git_odb_object *obj; size_t len; - git_otype type; + git_object_t type; cl_git_pass(git_oid_fromstr(&id, packed_objects_one[i])); diff --git a/tests/odb/streamwrite.c b/tests/odb/streamwrite.c index 591a20040..c174f6974 100644 --- a/tests/odb/streamwrite.c +++ b/tests/odb/streamwrite.c @@ -10,7 +10,7 @@ void test_odb_streamwrite__initialize(void) repo = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_repository_odb(&odb, repo)); - cl_git_pass(git_odb_open_wstream(&stream, odb, 14, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_open_wstream(&stream, odb, 14, GIT_OBJECT_BLOB)); cl_assert_equal_sz(14, stream->declared_size); } diff --git a/tests/pack/indexer.c b/tests/pack/indexer.c index 3a5021223..7b1daa984 100644 --- a/tests/pack/indexer.c +++ b/tests/pack/indexer.c @@ -156,7 +156,7 @@ void test_pack_indexer__fix_thin(void) cl_git_pass(git_repository_odb(&odb, repo)); /* Store the missing base into your ODB so the indexer can fix the pack */ - cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJECT_BLOB)); git_oid_fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18"); cl_assert_equal_oid(&should_id, &id); @@ -222,7 +222,7 @@ void test_pack_indexer__corrupt_length(void) cl_git_pass(git_repository_odb(&odb, repo)); /* Store the missing base into your ODB so the indexer can fix the pack */ - cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJECT_BLOB)); git_oid_fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18"); cl_assert_equal_oid(&should_id, &id); diff --git a/tests/pack/packbuilder.c b/tests/pack/packbuilder.c index bd2cebed2..6859001fe 100644 --- a/tests/pack/packbuilder.c +++ b/tests/pack/packbuilder.c @@ -76,7 +76,7 @@ static void seed_packbuilder(void) git_vector_foreach(&_commits, i, o) { git_object *obj; - cl_git_pass(git_object_lookup(&obj, _repo, o, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&obj, _repo, o, GIT_OBJECT_COMMIT)); cl_git_pass(git_packbuilder_insert_tree(_packbuilder, git_commit_tree_id((git_commit *)obj))); git_object_free(obj); diff --git a/tests/pack/sharing.c b/tests/pack/sharing.c index 81de9f81d..f6f78ca03 100644 --- a/tests/pack/sharing.c +++ b/tests/pack/sharing.c @@ -20,8 +20,8 @@ void test_pack_sharing__open_two_repos(void) git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); - cl_git_pass(git_object_lookup(&obj1, repo1, &id, GIT_OBJ_ANY)); - cl_git_pass(git_object_lookup(&obj2, repo2, &id, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj1, repo1, &id, GIT_OBJECT_ANY)); + cl_git_pass(git_object_lookup(&obj2, repo2, &id, GIT_OBJECT_ANY)); pos = 0; while ((error = git_strmap_next(&data, &pos, git__pack_cache)) == 0) { diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c index 830593707..6a2bd38d2 100644 --- a/tests/rebase/merge.c +++ b/tests/rebase/merge.c @@ -647,7 +647,7 @@ static void test_copy_note( cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); cl_git_pass(git_reference_peel((git_object **)&branch_commit, - branch_ref, GIT_OBJ_COMMIT)); + branch_ref, GIT_OBJECT_COMMIT)); /* Add a note to a commit */ cl_git_pass(git_note_create(¬e_id, repo, "refs/notes/test", diff --git a/tests/rebase/setup.c b/tests/rebase/setup.c index f00294574..34d5edbf6 100644 --- a/tests/rebase/setup.c +++ b/tests/rebase/setup.c @@ -76,7 +76,7 @@ void test_rebase_setup__merge(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("b146bd7608eac53d9bf9e1a6963543588b555c64\n", 41, "rebase/.git/ORIG_HEAD"); @@ -122,7 +122,7 @@ void test_rebase_setup__merge_root(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("b146bd7608eac53d9bf9e1a6963543588b555c64\n", 41, "rebase/.git/ORIG_HEAD"); @@ -172,7 +172,7 @@ void test_rebase_setup__merge_onto_and_upstream(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("d616d97082eb7bb2dc6f180a7cca940993b7a56f\n", 41, "rebase/.git/ORIG_HEAD"); @@ -226,7 +226,7 @@ void test_rebase_setup__merge_onto_upstream_and_branch(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("f87d14a4a236582a0278a916340a793714256864\n", 41, "rebase/.git/ORIG_HEAD"); @@ -284,7 +284,7 @@ void test_rebase_setup__merge_onto_upstream_and_branch_by_id(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("d616d97082eb7bb2dc6f180a7cca940993b7a56f\n", 41, "rebase/.git/ORIG_HEAD"); @@ -330,7 +330,7 @@ void test_rebase_setup__branch_with_merges(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("f87d14a4a236582a0278a916340a793714256864\n", 41, "rebase/.git/ORIG_HEAD"); @@ -378,7 +378,7 @@ void test_rebase_setup__orphan_branch(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("12c084412b952396962eb420716df01022b847cc\n", 41, "rebase/.git/ORIG_HEAD"); @@ -429,7 +429,7 @@ void test_rebase_setup__merge_null_branch_uses_HEAD(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("b146bd7608eac53d9bf9e1a6963543588b555c64\n", 41, "rebase/.git/ORIG_HEAD"); @@ -476,7 +476,7 @@ void test_rebase_setup__merge_from_detached(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("b146bd7608eac53d9bf9e1a6963543588b555c64\n", 41, "rebase/.git/ORIG_HEAD"); @@ -524,7 +524,7 @@ void test_rebase_setup__merge_branch_by_id(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("b146bd7608eac53d9bf9e1a6963543588b555c64\n", 41, "rebase/.git/ORIG_HEAD"); @@ -554,15 +554,15 @@ static int rebase_is_blocked(void) git_reference *branch_ref, *upstream_ref; git_annotated_commit *branch_head, *upstream_head; - + cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo)); - + cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/beef")); cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master")); - + cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - + error = git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL); git_annotated_commit_free(branch_head); diff --git a/tests/rebase/submodule.c b/tests/rebase/submodule.c index 5aa9ceb37..a28b3f4b2 100644 --- a/tests/rebase/submodule.c +++ b/tests/rebase/submodule.c @@ -44,7 +44,7 @@ void test_rebase_submodule__initialize(void) cl_git_pass(git_commit_create_v(&commit_id, repo, git_reference_name(master_ref), signature, signature, NULL, "Fixup .gitmodules", tree, 1, parent)); /* And a final reset, for good measure */ - cl_git_pass(git_object_lookup(&obj, repo, &commit_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&obj, repo, &commit_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, obj, GIT_RESET_HARD, &opts)); git_index_free(index); diff --git a/tests/refs/branches/upstream.c b/tests/refs/branches/upstream.c index 6024b1d7a..176f2a509 100644 --- a/tests/refs/branches/upstream.c +++ b/tests/refs/branches/upstream.c @@ -91,7 +91,7 @@ static void assert_merge_and_or_remote_key_missing(git_repository *repository, c { git_reference *branch; - cl_assert_equal_i(GIT_OBJ_COMMIT, git_object_type((git_object*)target)); + cl_assert_equal_i(GIT_OBJECT_COMMIT, git_object_type((git_object*)target)); cl_git_pass(git_branch_create(&branch, repository, entry_name, (git_commit*)target, 0)); cl_assert_equal_i(GIT_ENOTFOUND, git_branch_upstream(&upstream, branch)); @@ -108,7 +108,7 @@ void test_refs_branches_upstream__retrieve_a_remote_tracking_reference_from_a_br repository = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_repository_head(&head, repository)); - cl_git_pass(git_reference_peel(((git_object **)&target), head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(((git_object **)&target), head, GIT_OBJECT_COMMIT)); git_reference_free(head); assert_merge_and_or_remote_key_missing(repository, target, "remoteless"); diff --git a/tests/refs/peel.c b/tests/refs/peel.c index 09809e19e..38f3465a0 100644 --- a/tests/refs/peel.c +++ b/tests/refs/peel.c @@ -20,16 +20,16 @@ void test_refs_peel__cleanup(void) static void assert_peel_generic( git_repository *repo, const char *ref_name, - git_otype requested_type, + git_object_t requested_type, const char* expected_sha, - git_otype expected_type) + git_object_t expected_type) { git_oid expected_oid; git_reference *ref; git_object *peeled; cl_git_pass(git_reference_lookup(&ref, repo, ref_name)); - + cl_git_pass(git_reference_peel(&peeled, ref, requested_type)); cl_git_pass(git_oid_fromstr(&expected_oid, expected_sha)); @@ -43,21 +43,21 @@ static void assert_peel_generic( static void assert_peel( const char *ref_name, - git_otype requested_type, + git_object_t requested_type, const char* expected_sha, - git_otype expected_type) + git_object_t expected_type) { assert_peel_generic(g_repo, ref_name, requested_type, expected_sha, expected_type); } -static void assert_peel_error(int error, const char *ref_name, git_otype requested_type) +static void assert_peel_error(int error, const char *ref_name, git_object_t requested_type) { git_reference *ref; git_object *peeled; cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name)); - + cl_assert_equal_i(error, git_reference_peel(&peeled, ref, requested_type)); git_reference_free(ref); @@ -65,67 +65,67 @@ static void assert_peel_error(int error, const char *ref_name, git_otype request void test_refs_peel__can_peel_a_tag(void) { - assert_peel("refs/tags/test", GIT_OBJ_TAG, - "b25fa35b38051e4ae45d4222e795f9df2e43f1d1", GIT_OBJ_TAG); - assert_peel("refs/tags/test", GIT_OBJ_COMMIT, - "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT); - assert_peel("refs/tags/test", GIT_OBJ_TREE, - "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE); - assert_peel("refs/tags/point_to_blob", GIT_OBJ_BLOB, - "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OBJ_BLOB); + assert_peel("refs/tags/test", GIT_OBJECT_TAG, + "b25fa35b38051e4ae45d4222e795f9df2e43f1d1", GIT_OBJECT_TAG); + assert_peel("refs/tags/test", GIT_OBJECT_COMMIT, + "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT); + assert_peel("refs/tags/test", GIT_OBJECT_TREE, + "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE); + assert_peel("refs/tags/point_to_blob", GIT_OBJECT_BLOB, + "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OBJECT_BLOB); } void test_refs_peel__can_peel_a_branch(void) { - assert_peel("refs/heads/master", GIT_OBJ_COMMIT, - "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJ_COMMIT); - assert_peel("refs/heads/master", GIT_OBJ_TREE, - "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OBJ_TREE); + assert_peel("refs/heads/master", GIT_OBJECT_COMMIT, + "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJECT_COMMIT); + assert_peel("refs/heads/master", GIT_OBJECT_TREE, + "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OBJECT_TREE); } void test_refs_peel__can_peel_a_symbolic_reference(void) { - assert_peel("HEAD", GIT_OBJ_COMMIT, - "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJ_COMMIT); - assert_peel("HEAD", GIT_OBJ_TREE, - "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OBJ_TREE); + assert_peel("HEAD", GIT_OBJECT_COMMIT, + "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJECT_COMMIT); + assert_peel("HEAD", GIT_OBJECT_TREE, + "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OBJECT_TREE); } void test_refs_peel__cannot_peel_into_a_non_existing_target(void) { - assert_peel_error(GIT_EINVALIDSPEC, "refs/tags/point_to_blob", GIT_OBJ_TAG); + assert_peel_error(GIT_EINVALIDSPEC, "refs/tags/point_to_blob", GIT_OBJECT_TAG); } void test_refs_peel__can_peel_into_any_non_tag_object(void) { - assert_peel("refs/heads/master", GIT_OBJ_ANY, - "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJ_COMMIT); - assert_peel("refs/tags/point_to_blob", GIT_OBJ_ANY, - "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OBJ_BLOB); - assert_peel("refs/tags/test", GIT_OBJ_ANY, - "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT); + assert_peel("refs/heads/master", GIT_OBJECT_ANY, + "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJECT_COMMIT); + assert_peel("refs/tags/point_to_blob", GIT_OBJECT_ANY, + "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OBJECT_BLOB); + assert_peel("refs/tags/test", GIT_OBJECT_ANY, + "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT); } void test_refs_peel__can_peel_fully_peeled_packed_refs(void) { assert_peel_generic(g_peel_repo, - "refs/tags/tag-inside-tags", GIT_OBJ_ANY, + "refs/tags/tag-inside-tags", GIT_OBJECT_ANY, "0df1a5865c8abfc09f1f2182e6a31be550e99f07", - GIT_OBJ_COMMIT); + GIT_OBJECT_COMMIT); assert_peel_generic(g_peel_repo, - "refs/foo/tag-outside-tags", GIT_OBJ_ANY, + "refs/foo/tag-outside-tags", GIT_OBJECT_ANY, "0df1a5865c8abfc09f1f2182e6a31be550e99f07", - GIT_OBJ_COMMIT); + GIT_OBJECT_COMMIT); } void test_refs_peel__can_peel_fully_peeled_tag_to_tag(void) { assert_peel_generic(g_peel_repo, - "refs/tags/tag-inside-tags", GIT_OBJ_TAG, + "refs/tags/tag-inside-tags", GIT_OBJECT_TAG, "c2596aa0151888587ec5c0187f261e63412d9e11", - GIT_OBJ_TAG); + GIT_OBJECT_TAG); assert_peel_generic(g_peel_repo, - "refs/foo/tag-outside-tags", GIT_OBJ_TAG, + "refs/foo/tag-outside-tags", GIT_OBJECT_TAG, "c2596aa0151888587ec5c0187f261e63412d9e11", - GIT_OBJ_TAG); + GIT_OBJECT_TAG); } diff --git a/tests/refs/read.c b/tests/refs/read.c index 3c7a0a1bf..5a1f554f0 100644 --- a/tests/refs/read.c +++ b/tests/refs/read.c @@ -38,9 +38,9 @@ void test_refs_read__loose_tag(void) cl_assert(reference_is_packed(reference) == 0); cl_assert_equal_s(reference->name, loose_tag_ref_name); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJECT_ANY)); cl_assert(object != NULL); - cl_assert(git_object_type(object) == GIT_OBJ_TAG); + cl_assert(git_object_type(object) == GIT_OBJECT_TAG); /* Ensure the name of the tag matches the name of the reference */ cl_git_pass(git_buf_joinpath(&ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object))); @@ -78,9 +78,9 @@ void test_refs_read__symbolic(void) cl_git_pass(git_reference_resolve(&resolved_ref, reference)); cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJECT_ANY)); cl_assert(object != NULL); - cl_assert(git_object_type(object) == GIT_OBJ_COMMIT); + cl_assert(git_object_type(object) == GIT_OBJECT_COMMIT); git_oid_fromstr(&id, current_master_tip); cl_assert_equal_oid(&id, git_object_id(object)); @@ -106,9 +106,9 @@ void test_refs_read__nested_symbolic(void) cl_git_pass(git_reference_resolve(&resolved_ref, reference)); cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJECT_ANY)); cl_assert(object != NULL); - cl_assert(git_object_type(object) == GIT_OBJ_COMMIT); + cl_assert(git_object_type(object) == GIT_OBJECT_COMMIT); git_oid_fromstr(&id, current_master_tip); cl_assert_equal_oid(&id, git_object_id(object)); @@ -171,9 +171,9 @@ void test_refs_read__packed(void) cl_assert(reference_is_packed(reference)); cl_assert_equal_s(reference->name, packed_head_name); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJECT_ANY)); cl_assert(object != NULL); - cl_assert(git_object_type(object) == GIT_OBJ_COMMIT); + cl_assert(git_object_type(object) == GIT_OBJECT_COMMIT); git_object_free(object); diff --git a/tests/refs/reflog/messages.c b/tests/refs/reflog/messages.c index 3868e774d..5ca9ab31b 100644 --- a/tests/refs/reflog/messages.c +++ b/tests/refs/reflog/messages.c @@ -155,7 +155,7 @@ void test_refs_reflog_messages__branch_birth(void) cl_git_pass(git_signature_now(&sig, "me", "foo@example.com")); cl_git_pass(git_repository_head(&ref, g_repo)); - cl_git_pass(git_reference_peel((git_object **) &tree, ref, GIT_OBJ_TREE)); + cl_git_pass(git_reference_peel((git_object **) &tree, ref, GIT_OBJECT_TREE)); cl_git_pass(git_repository_set_head(g_repo, "refs/heads/orphan")); @@ -191,7 +191,7 @@ void test_refs_reflog_messages__commit_on_symbolic_ref_updates_head_reflog(void) cl_git_pass(git_signature_now(&sig, "me", "foo@example.com")); cl_git_pass(git_repository_head(&ref1, g_repo)); - cl_git_pass(git_reference_peel((git_object **) &tree, ref1, GIT_OBJ_TREE)); + cl_git_pass(git_reference_peel((git_object **) &tree, ref1, GIT_OBJECT_TREE)); nentries_master = reflog_entrycount(g_repo, "refs/heads/master"); diff --git a/tests/repo/env.c b/tests/repo/env.c index 8e2e5f85f..9dafda198 100644 --- a/tests/repo/env.c +++ b/tests/repo/env.c @@ -101,24 +101,24 @@ static void env_check_objects_(bool a, bool t, bool p, const char *file, int lin cl_git_expect(git_repository_open_ext(&repo, "attr", GIT_REPOSITORY_OPEN_FROM_ENV, NULL), 0, file, line); if (a) { - cl_git_expect(git_object_lookup(&object, repo, &oid_a, GIT_OBJ_BLOB), 0, file, line); + cl_git_expect(git_object_lookup(&object, repo, &oid_a, GIT_OBJECT_BLOB), 0, file, line); git_object_free(object); } else { - cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_a, GIT_OBJ_BLOB), file, line); + cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_a, GIT_OBJECT_BLOB), file, line); } if (t) { - cl_git_expect(git_object_lookup(&object, repo, &oid_t, GIT_OBJ_BLOB), 0, file, line); + cl_git_expect(git_object_lookup(&object, repo, &oid_t, GIT_OBJECT_BLOB), 0, file, line); git_object_free(object); } else { - cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_t, GIT_OBJ_BLOB), file, line); + cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_t, GIT_OBJECT_BLOB), file, line); } if (p) { - cl_git_expect(git_object_lookup(&object, repo, &oid_p, GIT_OBJ_COMMIT), 0, file, line); + cl_git_expect(git_object_lookup(&object, repo, &oid_p, GIT_OBJECT_COMMIT), 0, file, line); git_object_free(object); } else { - cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_p, GIT_OBJ_COMMIT), file, line); + cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_p, GIT_OBJECT_COMMIT), file, line); } git_repository_free(repo); diff --git a/tests/repo/hashfile.c b/tests/repo/hashfile.c index 3c27aafbf..0fb4e6772 100644 --- a/tests/repo/hashfile.c +++ b/tests/repo/hashfile.c @@ -20,20 +20,20 @@ void test_repo_hashfile__simple(void) git_buf full = GIT_BUF_INIT; /* hash with repo relative path */ - cl_git_pass(git_odb_hashfile(&a, "status/current_file", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "current_file", GIT_OBJ_BLOB, NULL)); + cl_git_pass(git_odb_hashfile(&a, "status/current_file", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "current_file", GIT_OBJECT_BLOB, NULL)); cl_assert_equal_oid(&a, &b); cl_git_pass(git_buf_joinpath(&full, git_repository_workdir(_repo), "current_file")); /* hash with full path */ - cl_git_pass(git_odb_hashfile(&a, full.ptr, GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJ_BLOB, NULL)); + cl_git_pass(git_odb_hashfile(&a, full.ptr, GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJECT_BLOB, NULL)); cl_assert_equal_oid(&a, &b); /* hash with invalid type */ - cl_git_fail(git_odb_hashfile(&a, full.ptr, GIT_OBJ_ANY)); - cl_git_fail(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJ_OFS_DELTA, NULL)); + cl_git_fail(git_odb_hashfile(&a, full.ptr, GIT_OBJECT_ANY)); + cl_git_fail(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJECT_OFS_DELTA, NULL)); git_buf_dispose(&full); } @@ -51,35 +51,35 @@ void test_repo_hashfile__filtered(void) cl_git_mkfile("status/testfile.bin", "other\r\nstuff\r\n"); /* not equal hashes because of filtering */ - cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, NULL)); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_BLOB, NULL)); cl_assert(git_oid_cmp(&a, &b)); /* equal hashes because filter is binary */ - cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, NULL)); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJECT_BLOB, NULL)); cl_assert_equal_oid(&a, &b); /* equal hashes when 'as_file' points to binary filtering */ - cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, "foo.bin")); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_BLOB, "foo.bin")); cl_assert_equal_oid(&a, &b); /* not equal hashes when 'as_file' points to text filtering */ - cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, "foo.txt")); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJECT_BLOB, "foo.txt")); cl_assert(git_oid_cmp(&a, &b)); /* equal hashes when 'as_file' is empty and turns off filtering */ - cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, "")); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_BLOB, "")); cl_assert_equal_oid(&a, &b); - cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, "")); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJECT_BLOB, "")); cl_assert_equal_oid(&a, &b); /* some hash type failures */ cl_git_fail(git_odb_hashfile(&a, "status/testfile.txt", 0)); - cl_git_fail(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_ANY, NULL)); + cl_git_fail(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_ANY, NULL)); } diff --git a/tests/repo/head.c b/tests/repo/head.c index ed3b3dcc3..822990555 100644 --- a/tests/repo/head.c +++ b/tests/repo/head.c @@ -80,7 +80,7 @@ static void assert_head_is_correctly_detached(void) cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_object_lookup(&commit, repo, git_reference_target(head), GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&commit, repo, git_reference_target(head), GIT_OBJECT_COMMIT)); git_object_free(commit); git_reference_free(head); @@ -120,7 +120,7 @@ void test_repo_head__set_head_detached_Detaches_HEAD_and_make_it_point_to_the_pe git_object *tag; cl_git_pass(git_revparse_single(&tag, repo, "tags/test")); - cl_assert_equal_i(GIT_OBJ_TAG, git_object_type(tag)); + cl_assert_equal_i(GIT_OBJECT_TAG, git_object_type(tag)); cl_git_pass(git_repository_set_head_detached(repo, git_object_id(tag))); diff --git a/tests/reset/hard.c b/tests/reset/hard.c index c63640e1c..b6e91395b 100644 --- a/tests/reset/hard.c +++ b/tests/reset/hard.c @@ -108,7 +108,7 @@ static void index_entry_init(git_index *index, int side, git_oid *oid) memset(&entry, 0x0, sizeof(git_index_entry)); entry.path = "conflicting_file"; - GIT_IDXENTRY_STAGE_SET(&entry, side); + GIT_INDEX_ENTRY_STAGE_SET(&entry, side); entry.mode = 0100644; git_oid_cpy(&entry.id, oid); @@ -248,7 +248,7 @@ void test_reset_hard__switch_file_to_dir(void) git_oid src_id, tgt_id; cl_git_pass(git_repository_odb(&odb, repo)); - cl_git_pass(git_odb_write(&entry.id, odb, "", 0, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&entry.id, odb, "", 0, GIT_OBJECT_BLOB)); git_odb_free(odb); entry.mode = GIT_FILEMODE_BLOB; @@ -282,12 +282,12 @@ void test_reset_hard__switch_file_to_dir(void) git_signature_free(sig); /* Let's go to a known state of the src commit with the file named 'dir' */ - cl_git_pass(git_object_lookup(&commit, repo, &src_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&commit, repo, &src_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, commit, GIT_RESET_HARD, NULL)); git_object_free(commit); /* And now we move over to the commit with the directory named 'dir' */ - cl_git_pass(git_object_lookup(&commit, repo, &tgt_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&commit, repo, &tgt_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, commit, GIT_RESET_HARD, NULL)); git_object_free(commit); } diff --git a/tests/reset/soft.c b/tests/reset/soft.c index 0ad47be2c..d9cfb0553 100644 --- a/tests/reset/soft.c +++ b/tests/reset/soft.c @@ -149,7 +149,7 @@ void test_reset_soft__fails_when_index_contains_conflicts_independently_of_MERGE git_index_free(index); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel(&target, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&target, head, GIT_OBJECT_COMMIT)); git_reference_free(head); cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT, NULL)); diff --git a/tests/revert/bare.c b/tests/revert/bare.c index fda2b82b0..fc7d03065 100644 --- a/tests/revert/bare.c +++ b/tests/revert/bare.c @@ -68,7 +68,7 @@ void test_revert_bare__conflicts(void) git_oid_fromstr(&revert_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45"); cl_git_pass(git_repository_head(&head_ref, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head_ref, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head_ref, GIT_OBJECT_COMMIT)); cl_git_pass(git_commit_lookup(&revert_commit, repo, &revert_oid)); cl_git_pass(git_revert_commit(&index, repo, revert_commit, head_commit, 0, NULL)); diff --git a/tests/revert/workdir.c b/tests/revert/workdir.c index 53bb0e439..9acf20d6f 100644 --- a/tests/revert/workdir.c +++ b/tests/revert/workdir.c @@ -80,7 +80,7 @@ void test_revert_workdir__conflicts(void) git_oid_fromstr(&revert_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45"); cl_git_pass(git_repository_head(&head_ref, 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(repo, (git_object *)head, GIT_RESET_HARD, NULL)); cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid)); @@ -178,7 +178,7 @@ void test_revert_workdir__again(void) }; cl_git_pass(git_repository_head(&head_ref, repo)); - cl_git_pass(git_reference_peel((git_object **)&orig_head, head_ref, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&orig_head, head_ref, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, (git_object *)orig_head, GIT_RESET_HARD, NULL)); cl_git_pass(git_revert(repo, orig_head, NULL)); @@ -477,7 +477,7 @@ void test_revert_workdir__head(void) /* HEAD is 2d440f2b3147d3dc7ad1085813478d6d869d5a4d */ 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)); cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD, NULL)); cl_git_pass(git_revert(repo, commit, NULL)); @@ -495,7 +495,7 @@ void test_revert_workdir__nonmerge_fails_mainline_specified(void) git_revert_options opts = GIT_REVERT_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_revert(repo, commit, &opts)); diff --git a/tests/revwalk/basic.c b/tests/revwalk/basic.c index efb48cbf1..2eb0c3537 100644 --- a/tests/revwalk/basic.c +++ b/tests/revwalk/basic.c @@ -292,9 +292,9 @@ void test_revwalk_basic__multiple_push_1(void) } /* -* Difference between test_revwalk_basic__multiple_push_1 and +* Difference between test_revwalk_basic__multiple_push_1 and * test_revwalk_basic__multiple_push_2 is in the order reference -* refs/heads/packed-test and commit 5b5b02 are pushed. +* refs/heads/packed-test and commit 5b5b02 are pushed. * revwalk should return same commits in both the tests. * $ git rev-list 5b5b02 HEAD ^refs/heads/packed-test @@ -509,7 +509,7 @@ void test_revwalk_basic__big_timestamp(void) revwalk_basic_setup_walk("testrepo.git"); cl_git_pass(git_repository_head(&head, _repo)); - cl_git_pass(git_reference_peel((git_object **) &tip, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **) &tip, head, GIT_OBJECT_COMMIT)); /* Commit with a far-ahead timestamp, we should be able to parse it in the revwalk */ cl_git_pass(git_signature_new(&sig, "Joe", "joe@example.com", 2399662595, 0)); diff --git a/tests/revwalk/mergebase.c b/tests/revwalk/mergebase.c index ee078b3e7..bee0b926e 100644 --- a/tests/revwalk/mergebase.c +++ b/tests/revwalk/mergebase.c @@ -198,12 +198,12 @@ static void assert_mergebase_many(const char *expected_sha, int count, ...) memset(oids, 0x0, count * sizeof(git_oid)); va_start(ap, count); - + for (i = 0; i < count; ++i) { partial_oid = va_arg(ap, char *); cl_git_pass(git_oid_fromstrn(&oid, partial_oid, strlen(partial_oid))); - cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJECT_COMMIT)); git_oid_cpy(&oids[i], git_object_id(object)); git_object_free(object); } @@ -267,7 +267,7 @@ static void assert_mergebase_octopus(const char *expected_sha, int count, ...) partial_oid = va_arg(ap, char *); cl_git_pass(git_oid_fromstrn(&oid, partial_oid, strlen(partial_oid))); - cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJECT_COMMIT)); git_oid_cpy(&oids[i], git_object_id(object)); git_object_free(object); } diff --git a/tests/stash/save.c b/tests/stash/save.c index eaa72a89e..c38ef8274 100644 --- a/tests/stash/save.c +++ b/tests/stash/save.c @@ -9,7 +9,7 @@ static git_oid stash_tip_oid; /* * Friendly reminder, in order to ease the reading of the following tests: * - * "stash" points to the worktree commit + * "stash" points to the worktree commit * "stash^1" points to the base commit (HEAD when the stash was created) * "stash^2" points to the index commit * "stash^3" points to the untracked commit @@ -35,7 +35,7 @@ void test_stash_save__cleanup(void) cl_fixture_cleanup("sorry-it-is-a-non-bare-only-party"); } -static void assert_object_oid(const char* revision, const char* expected_oid, git_otype type) +static void assert_object_oid(const char* revision, const char* expected_oid, git_object_t type) { int result; git_object *obj; @@ -55,7 +55,7 @@ static void assert_object_oid(const char* revision, const char* expected_oid, gi static void assert_blob_oid(const char* revision, const char* expected_oid) { - assert_object_oid(revision, expected_oid, GIT_OBJ_BLOB); + assert_object_oid(revision, expected_oid, GIT_OBJECT_BLOB); } void test_stash_save__does_not_keep_index_by_default(void) @@ -212,7 +212,7 @@ void test_stash_save__untracked_regression(void) cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); opts.checkout_strategy = GIT_CHECKOUT_FORCE; @@ -275,12 +275,12 @@ void test_stash_save__can_stash_against_a_detached_head(void) void test_stash_save__stashing_updates_the_reflog(void) { - assert_object_oid("refs/stash@{0}", NULL, GIT_OBJ_COMMIT); + assert_object_oid("refs/stash@{0}", NULL, GIT_OBJECT_COMMIT); cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT)); - assert_object_oid("refs/stash@{0}", git_oid_tostr_s(&stash_tip_oid), GIT_OBJ_COMMIT); - assert_object_oid("refs/stash@{1}", NULL, GIT_OBJ_COMMIT); + assert_object_oid("refs/stash@{0}", git_oid_tostr_s(&stash_tip_oid), GIT_OBJECT_COMMIT); + assert_object_oid("refs/stash@{1}", NULL, GIT_OBJECT_COMMIT); } void test_stash_save__cannot_stash_when_there_are_no_local_change(void) @@ -386,7 +386,7 @@ void test_stash_save__can_stage_normal_then_stage_untracked(void) assert_blob_oid("stash@{1}^2:who", "cc628ccd10742baea8241c5924df992b5c019f71"); /* world */ assert_blob_oid("stash@{1}^2:when", NULL); - assert_object_oid("stash@{1}^3", NULL, GIT_OBJ_COMMIT); + assert_object_oid("stash@{1}^3", NULL, GIT_OBJECT_COMMIT); assert_blob_oid("stash@{0}^0:what", "ce013625030ba8dba906f756967f9e9ca394464a"); /* hello */ assert_blob_oid("stash@{0}^0:how", "ac790413e2d7a26c3767e78c57bb28716686eebc"); /* small */ @@ -415,7 +415,7 @@ void test_stash_save__including_untracked_without_any_untracked_file_creates_an_ cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED)); - assert_object_oid("stash^3^{tree}", EMPTY_TREE, GIT_OBJ_TREE); + assert_object_oid("stash^3^{tree}", EMPTY_TREE, GIT_OBJECT_TREE); } void test_stash_save__ignored_directory(void) diff --git a/tests/status/ignore.c b/tests/status/ignore.c index c986a6b3c..496582136 100644 --- a/tests/status/ignore.c +++ b/tests/status/ignore.c @@ -167,7 +167,7 @@ void test_status_ignore__ignore_pattern_ignorecase(void) cl_git_mkfile("empty_standard_repo/A.txt", "Differs in case"); cl_git_pass(git_repository_index(&index, g_repo)); - ignore_case = (git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0; + ignore_case = (git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0; git_index_free(index); cl_git_pass(git_status_file(&flags, g_repo, "A.txt")); diff --git a/tests/status/renames.c b/tests/status/renames.c index 445995264..7deec980f 100644 --- a/tests/status/renames.c +++ b/tests/status/renames.c @@ -483,7 +483,7 @@ void test_status_renames__both_casechange_one(void) cl_git_pass(git_status_list_new(&statuslist, g_repo, &opts)); - check_status(statuslist, (index_caps & GIT_INDEXCAP_IGNORE_CASE) ? + check_status(statuslist, (index_caps & GIT_INDEX_CAPABILITY_IGNORE_CASE) ? expected_icase : expected_case, 1); git_status_list_free(statuslist); @@ -550,7 +550,7 @@ void test_status_renames__both_casechange_two(void) cl_git_pass(git_status_list_new(&statuslist, g_repo, &opts)); - check_status(statuslist, (index_caps & GIT_INDEXCAP_IGNORE_CASE) ? + check_status(statuslist, (index_caps & GIT_INDEX_CAPABILITY_IGNORE_CASE) ? expected_icase : expected_case, 4); git_status_list_free(statuslist); diff --git a/tests/status/single.c b/tests/status/single.c index 6efaab294..e7f92097c 100644 --- a/tests/status/single.c +++ b/tests/status/single.c @@ -21,7 +21,7 @@ void test_status_single__hash_single_file(void) cl_git_mkfile(file_name, file_contents); cl_set_cleanup(&cleanup__remove_file, (void *)file_name); - cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJECT_BLOB)); cl_assert_equal_oid(&expected_id, &actual_id); } @@ -39,7 +39,7 @@ void test_status_single__hash_single_empty_file(void) cl_git_mkfile(file_name, file_contents); cl_set_cleanup(&cleanup__remove_file, (void *)file_name); - cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJECT_BLOB)); cl_assert_equal_oid(&expected_id, &actual_id); } diff --git a/tests/status/worktree.c b/tests/status/worktree.c index 7abc703db..4c37a337c 100644 --- a/tests/status/worktree.c +++ b/tests/status/worktree.c @@ -154,7 +154,7 @@ void test_status_worktree__swap_subdir_and_file(void) bool ignore_case; cl_git_pass(git_repository_index(&index, repo)); - ignore_case = (git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0; + ignore_case = (git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0; git_index_free(index); /* first alter the contents of the worktree */ @@ -889,7 +889,7 @@ void test_status_worktree__sorting_by_case(void) cl_git_pass(git_repository_index(&index, repo)); native_ignore_case = - (git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0; + (git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0; git_index_free(index); memset(&counts, 0, sizeof(counts)); @@ -1163,7 +1163,7 @@ void test_status_worktree__update_index_with_symlink_doesnt_change_mode(void) opts.flags = GIT_STATUS_OPT_DEFAULTS | GIT_STATUS_OPT_UPDATE_INDEX; 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)); @@ -1222,7 +1222,7 @@ void test_status_worktree__with_directory_in_pathlist(void) cl_git_pass(git_repository_index(&index, repo)); native_ignore_case = - (git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0; + (git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0; git_index_free(index); opts.pathspec.strings = &subdir_path; diff --git a/tests/submodule/init.c b/tests/submodule/init.c index b84adf508..84143e18f 100644 --- a/tests/submodule/init.c +++ b/tests/submodule/init.c @@ -87,7 +87,7 @@ void test_submodule_init__relative_url_detached_head(void) /* Put the parent repository into a detached head state. */ cl_git_pass(git_repository_head(&head_ref, g_repo)); - cl_git_pass(git_reference_peel(&head_commit, head_ref, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&head_commit, head_ref, GIT_OBJECT_COMMIT)); cl_git_pass(git_repository_set_head_detached(g_repo, git_commit_id((git_commit *)head_commit))); diff --git a/tests/submodule/update.c b/tests/submodule/update.c index cbd519d81..08a279a48 100644 --- a/tests/submodule/update.c +++ b/tests/submodule/update.c @@ -241,7 +241,7 @@ void test_submodule_update__update_already_checked_out_submodule(void) checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE; cl_git_pass(git_reference_lookup(&branch_reference, g_repo, "refs/heads/alternate_1")); - cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJECT_COMMIT)); cl_git_pass(git_checkout_tree(g_repo, branch_commit, &checkout_options)); cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference))); @@ -277,7 +277,7 @@ void test_submodule_update__update_already_checked_out_submodule(void) /* verify that the expected callbacks have been called. */ cl_assert_equal_i(1, update_payload.checkout_progress_called); - + git_submodule_free(sm); git_object_free(branch_commit); git_reference_free(branch_reference); @@ -319,7 +319,7 @@ void test_submodule_update__update_blocks_on_dirty_wd(void) checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE; cl_git_pass(git_reference_lookup(&branch_reference, g_repo, "refs/heads/alternate_1")); - cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJECT_COMMIT)); cl_git_pass(git_checkout_tree(g_repo, branch_commit, &checkout_options)); cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference))); @@ -396,7 +396,7 @@ void test_submodule_update__can_force_update(void) checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE; cl_git_pass(git_reference_lookup(&branch_reference, g_repo, "refs/heads/alternate_1")); - cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJECT_COMMIT)); cl_git_pass(git_checkout_tree(g_repo, branch_commit, &checkout_options)); cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference))); |