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).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
diff --git a/include/git2/common.h b/include/git2/common.h
index 152e23a..82f6ba4 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/object.h b/include/git2/object.h
index a798c9d..01dc37a 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 006a75b..b752b90 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 0dd453e..ec67a8f 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 a39ebb9..344c203 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 792f103..75341e8 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 cb95fb5..12683e4 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 1a363c1..e98a4c6 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