Commit 19faf7c5 by Edward Thomson

object_type: update public API to use git_object_t

git_object_t is the future; update the public API to use it.  This will
also ensure that we can build our tests which make use of the old API
without modification (and without compiler warnings).
parent 26b21b39
......@@ -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)
*
......
......@@ -30,7 +30,7 @@ GIT_BEGIN_DECL
*
* The 'type' parameter must match the type of the object
* in the odb; the method will fail otherwise.
* The special value 'GIT_OBJ_ANY' may be passed to let
* The special value 'GIT_OBJECT_ANY' may be passed to let
* the method guess the object's type.
*
* @param object pointer to the looked-up object
......@@ -43,7 +43,7 @@ GIT_EXTERN(int) git_object_lookup(
git_object **object,
git_repository *repo,
const git_oid *id,
git_otype type);
git_object_t type);
/**
* Lookup a reference to one of the objects in a repository,
......@@ -62,7 +62,7 @@ GIT_EXTERN(int) git_object_lookup(
*
* The 'type' parameter must match the type of the object
* in the odb; the method will fail otherwise.
* The special value 'GIT_OBJ_ANY' may be passed to let
* The special value 'GIT_OBJECT_ANY' may be passed to let
* the method guess the object's type.
*
* @param object_out pointer where to store the looked-up object
......@@ -77,7 +77,7 @@ GIT_EXTERN(int) git_object_lookup_prefix(
git_repository *repo,
const git_oid *id,
size_t len,
git_otype type);
git_object_t type);
/**
......@@ -94,7 +94,7 @@ GIT_EXTERN(int) git_object_lookup_bypath(
git_object **out,
const git_object *treeish,
const char *path,
git_otype type);
git_object_t type);
/**
* Get the id (SHA1) of a repository object
......@@ -124,7 +124,7 @@ GIT_EXTERN(int) git_object_short_id(git_buf *out, const git_object *obj);
* @param obj the repository object
* @return the object's type
*/
GIT_EXTERN(git_otype) git_object_type(const git_object *obj);
GIT_EXTERN(git_object_t) git_object_type(const git_object *obj);
/**
* Get the repository that owns this object
......@@ -166,24 +166,24 @@ GIT_EXTERN(void) git_object_free(git_object *object);
* @param type object type to convert.
* @return the corresponding string representation.
*/
GIT_EXTERN(const char *) git_object_type2string(git_otype type);
GIT_EXTERN(const char *) git_object_type2string(git_object_t type);
/**
* Convert a string object type representation to it's git_otype.
* Convert a string object type representation to it's git_object_t.
*
* @param str the string to convert.
* @return the corresponding git_otype.
* @return the corresponding git_object_t.
*/
GIT_EXTERN(git_otype) git_object_string2type(const char *str);
GIT_EXTERN(git_object_t) git_object_string2type(const char *str);
/**
* Determine if the given git_otype is a valid loose object type.
* Determine if the given git_object_t is a valid loose object type.
*
* @param type object type to test.
* @return true if the type represents a valid loose object type,
* false otherwise.
*/
GIT_EXTERN(int) git_object_typeisloose(git_otype type);
GIT_EXTERN(int) git_object_typeisloose(git_object_t type);
/**
* Get the size in bytes for the structure which
......@@ -197,7 +197,7 @@ GIT_EXTERN(int) git_object_typeisloose(git_otype type);
* @param type object type to get its size
* @return size in bytes of the object
*/
GIT_EXTERN(size_t) git_object__size(git_otype type);
GIT_EXTERN(size_t) git_object__size(git_object_t type);
/**
* Recursively peel an object until an object of the specified type is met.
......@@ -206,7 +206,7 @@ GIT_EXTERN(size_t) git_object__size(git_otype type);
* GIT_EINVALIDSPEC will be returned (e.g. trying to peel a blob to a
* tree).
*
* If you pass `GIT_OBJ_ANY` as the target type, then the object will
* If you pass `GIT_OBJECT_ANY` as the target type, then the object will
* be peeled until the type changes. A tag will be peeled until the
* referenced object is no longer a tag, and a commit will be peeled
* to a tree. Any other object type will return GIT_EINVALIDSPEC.
......@@ -219,13 +219,13 @@ GIT_EXTERN(size_t) git_object__size(git_otype type);
*
* @param peeled Pointer to the peeled git_object
* @param object The object to be processed
* @param target_type The type of the requested object (a GIT_OBJ_ value)
* @param target_type The type of the requested object (a GIT_OBJECT_ value)
* @return 0 on success, GIT_EINVALIDSPEC, GIT_EPEEL, or an error code
*/
GIT_EXTERN(int) git_object_peel(
git_object **peeled,
const git_object *object,
git_otype target_type);
git_object_t target_type);
/**
* Create an in-memory copy of a Git object. The copy must be
......
......@@ -146,7 +146,7 @@ GIT_EXTERN(int) git_odb_read_prefix(git_odb_object **out, git_odb *db, const git
* - 0 if the object was read;
* - GIT_ENOTFOUND if the object is not in the database.
*/
GIT_EXTERN(int) git_odb_read_header(size_t *len_out, git_otype *type_out, git_odb *db, const git_oid *id);
GIT_EXTERN(int) git_odb_read_header(size_t *len_out, git_object_t *type_out, git_odb *db, const git_oid *id);
/**
* Determine if the given object can be found in the object database.
......@@ -189,9 +189,9 @@ typedef struct git_odb_expand_id {
/**
* The (optional) type of the object to search for; leave as `0` or set
* to `GIT_OBJ_ANY` to query for any object matching the ID.
* to `GIT_OBJECT_ANY` to query for any object matching the ID.
*/
git_otype type;
git_object_t type;
} git_odb_expand_id;
/**
......@@ -270,7 +270,7 @@ GIT_EXTERN(int) git_odb_foreach(git_odb *db, git_odb_foreach_cb cb, void *payloa
* @param type type of the data to store
* @return 0 or an error code
*/
GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size_t len, git_otype type);
GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size_t len, git_object_t type);
/**
* Open a stream to write an object into the ODB
......@@ -293,7 +293,7 @@ GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size
* @param type type of the object that will be written
* @return 0 if the stream was created; error code otherwise
*/
GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **out, git_odb *db, git_off_t size, git_otype type);
GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **out, git_odb *db, git_off_t size, git_object_t type);
/**
* Write to an odb stream
......@@ -366,7 +366,7 @@ GIT_EXTERN(void) git_odb_stream_free(git_odb_stream *stream);
GIT_EXTERN(int) git_odb_open_rstream(
git_odb_stream **out,
size_t *len,
git_otype *type,
git_object_t *type,
git_odb *db,
const git_oid *oid);
......@@ -406,7 +406,7 @@ GIT_EXTERN(int) git_odb_write_pack(
* @param type of the data to hash
* @return 0 or an error code
*/
GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_otype type);
GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_object_t type);
/**
* Read a file from disk and fill a git_oid with the object id
......@@ -421,7 +421,7 @@ GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_oty
* @param type the type of the object that will be hashed
* @return 0 or an error code
*/
GIT_EXTERN(int) git_odb_hashfile(git_oid *out, const char *path, git_otype type);
GIT_EXTERN(int) git_odb_hashfile(git_oid *out, const char *path, git_object_t type);
/**
* Create a copy of an odb_object
......@@ -487,7 +487,7 @@ GIT_EXTERN(size_t) git_odb_object_size(git_odb_object *object);
* @param object the object
* @return the type
*/
GIT_EXTERN(git_otype) git_odb_object_type(git_odb_object *object);
GIT_EXTERN(git_object_t) git_odb_object_type(git_odb_object *object);
/**
* Add a custom backend to an existing Object DB
......
......@@ -699,19 +699,19 @@ GIT_EXTERN(int) git_reference_normalize_name(
* The retrieved `peeled` object is owned by the repository
* and should be closed with the `git_object_free` method.
*
* If you pass `GIT_OBJ_ANY` as the target type, then the object
* If you pass `GIT_OBJECT_ANY` as the target type, then the object
* will be peeled until a non-tag object is met.
*
* @param out Pointer to the peeled git_object
* @param ref The reference to be processed
* @param type The type of the requested object (GIT_OBJ_COMMIT,
* GIT_OBJ_TAG, GIT_OBJ_TREE, GIT_OBJ_BLOB or GIT_OBJ_ANY).
* @param type The type of the requested object (GIT_OBJECT_COMMIT,
* GIT_OBJECT_TAG, GIT_OBJECT_TREE, GIT_OBJECT_BLOB or GIT_OBJECT_ANY).
* @return 0 on success, GIT_EAMBIGUOUS, GIT_ENOTFOUND or an error code
*/
GIT_EXTERN(int) git_reference_peel(
git_object **out,
git_reference *ref,
git_otype type);
git_object_t type);
/**
* Ensure the reference name is well-formed.
......
......@@ -685,7 +685,7 @@ GIT_EXTERN(int) git_repository_mergehead_foreach(
* @param repo Repository pointer
* @param path Path to file on disk whose contents should be hashed. If the
* repository is not NULL, this can be a relative path.
* @param type The object type to hash as (e.g. GIT_OBJ_BLOB)
* @param type The object type to hash as (e.g. GIT_OBJECT_BLOB)
* @param as_path The path to use to look up filtering rules. If this is
* NULL, then the `path` parameter will be used instead. If
* this is passed as the empty string, then no filters will be
......@@ -696,7 +696,7 @@ GIT_EXTERN(int) git_repository_hashfile(
git_oid *out,
git_repository *repo,
const char *path,
git_otype type,
git_object_t type,
const char *as_path);
/**
......
......@@ -33,30 +33,30 @@ struct git_odb_backend {
* the function git_odb_backend_malloc to ensure that it can
* be safely freed later. */
int (* read)(
void **, size_t *, git_otype *, git_odb_backend *, const git_oid *);
void **, size_t *, git_object_t *, git_odb_backend *, const git_oid *);
/* To find a unique object given a prefix of its oid. The oid given
* must be so that the remaining (GIT_OID_HEXSZ - len)*4 bits are 0s.
*/
int (* read_prefix)(
git_oid *, void **, size_t *, git_otype *,
git_oid *, void **, size_t *, git_object_t *,
git_odb_backend *, const git_oid *, size_t);
int (* read_header)(
size_t *, git_otype *, git_odb_backend *, const git_oid *);
size_t *, git_object_t *, git_odb_backend *, const git_oid *);
/**
* Write an object into the backend. The id of the object has
* already been calculated and is passed in.
*/
int (* write)(
git_odb_backend *, const git_oid *, const void *, size_t, git_otype);
git_odb_backend *, const git_oid *, const void *, size_t, git_object_t);
int (* writestream)(
git_odb_stream **, git_odb_backend *, git_off_t, git_otype);
git_odb_stream **, git_odb_backend *, git_off_t, git_object_t);
int (* readstream)(
git_odb_stream **, size_t *, git_otype *,
git_odb_stream **, size_t *, git_object_t *,
git_odb_backend *, const git_oid *);
int (* exists)(
......
......@@ -102,7 +102,7 @@ GIT_EXTERN(const git_oid *) git_tag_target_id(const git_tag *tag);
* @param tag a previously loaded tag.
* @return type of the tagged object
*/
GIT_EXTERN(git_otype) git_tag_target_type(const git_tag *tag);
GIT_EXTERN(git_object_t) git_tag_target_type(const git_tag *tag);
/**
* Get the name of a tag
......
......@@ -189,7 +189,7 @@ GIT_EXTERN(const git_oid *) git_tree_entry_id(const git_tree_entry *entry);
* @param entry a tree entry
* @return the type of the pointed object
*/
GIT_EXTERN(git_otype) git_tree_entry_type(const git_tree_entry *entry);
GIT_EXTERN(git_object_t) git_tree_entry_type(const git_tree_entry *entry);
/**
* Get the UNIX file attributes of a tree entry
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment