summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-11-28 14:26:57 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2018-12-01 11:54:57 +0000
commit168fe39bea3368972a8b1a33d5908e73bc790c18 (patch)
treec6d07340e2d8d2d66091c44c7763f3e1823acca2 /src
parent18e71e6d597abe6c7feb666429c921bd19dc0ba8 (diff)
downloadlibgit2-168fe39bea3368972a8b1a33d5908e73bc790c18.tar.gz
object_type: use new enumeration namesethomson/index_fixes
Use the new object_type enumeration names within the codebase.
Diffstat (limited to 'src')
-rw-r--r--src/annotated_commit.c4
-rw-r--r--src/blame.c2
-rw-r--r--src/blame_git.c6
-rw-r--r--src/blob.c8
-rw-r--r--src/cache.c20
-rw-r--r--src/cache.h4
-rw-r--r--src/checkout.c4
-rw-r--r--src/cherrypick.c2
-rw-r--r--src/commit.c10
-rw-r--r--src/commit_list.c2
-rw-r--r--src/describe.c12
-rw-r--r--src/diff_file.c6
-rw-r--r--src/diff_generate.c2
-rw-r--r--src/diff_generate.h2
-rw-r--r--src/diff_tform.c2
-rw-r--r--src/indexer.c34
-rw-r--r--src/iterator.c4
-rw-r--r--src/mailmap.c2
-rw-r--r--src/merge.c6
-rw-r--r--src/object.c106
-rw-r--r--src/object.h20
-rw-r--r--src/object_api.c16
-rw-r--r--src/odb.c58
-rw-r--r--src/odb.h14
-rw-r--r--src/odb_loose.c20
-rw-r--r--src/odb_mempack.c12
-rw-r--r--src/odb_pack.c6
-rw-r--r--src/pack-objects.c32
-rw-r--r--src/pack-objects.h2
-rw-r--r--src/pack.c52
-rw-r--r--src/pack.h10
-rw-r--r--src/push.c12
-rw-r--r--src/reader.c2
-rw-r--r--src/rebase.c4
-rw-r--r--src/refdb_fs.c4
-rw-r--r--src/refs.c12
-rw-r--r--src/repository.c10
-rw-r--r--src/reset.c4
-rw-r--r--src/revert.c2
-rw-r--r--src/revparse.c36
-rw-r--r--src/revwalk.c4
-rw-r--r--src/settings.c2
-rw-r--r--src/submodule.c4
-rw-r--r--src/tag.c12
-rw-r--r--src/tag.h2
-rw-r--r--src/transports/local.c8
-rw-r--r--src/tree.c24
47 files changed, 311 insertions, 311 deletions
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(&current_id, repo, GIT_HEAD_FILE)) < 0)
return error;
- if ((error = git_object_lookup(&commit, repo, &current_id, GIT_OBJ_COMMIT)) < 0)
+ if ((error = git_object_lookup(&commit, repo, &current_id, GIT_OBJECT_COMMIT)) < 0)
return error;
/* The first step is to perform a describe of HEAD, so we can leverage this */
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 8a8c4b984..ffe6d80e1 100644
--- a/src/diff_generate.c
+++ b/src/diff_generate.c
@@ -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++;
}
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/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)
diff --git a/src/odb.c b/src/odb.c
index f1c7ebcbd..3aedd80a6 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -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)
{
diff --git a/src/odb.h b/src/odb.h
index b354108e7..8c73515f0 100644
--- a/src/odb.h
+++ b/src/odb.h
@@ -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 95ab6090e..c6f7c2025 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -2450,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;
@@ -2524,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;
@@ -2626,10 +2626,10 @@ static int detach(git_repository *repo, const git_oid *id, const char *new)
if ((error = git_reference_lookup(&current, repo, GIT_HEAD_FILE)) < 0)
return error;
- if ((error = git_object_lookup(&object, repo, id, GIT_OBJ_ANY)) < 0)
+ if ((error = git_object_lookup(&object, repo, id, GIT_OBJECT_ANY)) < 0)
goto cleanup;
- if ((error = git_object_peel(&peeled, object, GIT_OBJ_COMMIT)) < 0)
+ if ((error = git_object_peel(&peeled, object, GIT_OBJECT_COMMIT)) < 0)
goto cleanup;
if (new == NULL)
@@ -2729,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 094eefed3..f52b65876 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -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;
}
diff --git a/src/tag.c b/src/tag.c
index c45335151..3d1b8c2c5 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -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);
}
diff --git a/src/tag.h b/src/tag.h
index 734770abd..76ae1508e 100644
--- a/src/tag.h
+++ b/src/tag.h
@@ -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;