From 168fe39bea3368972a8b1a33d5908e73bc790c18 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Wed, 28 Nov 2018 14:26:57 +0000 Subject: object_type: use new enumeration names Use the new object_type enumeration names within the codebase. --- src/annotated_commit.c | 4 +- src/blame.c | 2 +- src/blame_git.c | 6 +- src/blob.c | 8 +-- src/cache.c | 20 +++---- src/cache.h | 4 +- src/checkout.c | 4 +- src/cherrypick.c | 2 +- src/commit.c | 10 ++-- src/commit_list.c | 2 +- src/describe.c | 12 ++-- src/diff_file.c | 6 +- src/diff_generate.c | 2 +- src/diff_generate.h | 2 +- src/diff_tform.c | 2 +- src/indexer.c | 34 ++++++------ src/iterator.c | 4 +- src/mailmap.c | 2 +- src/merge.c | 6 +- src/object.c | 106 ++++++++++++++++++------------------ src/object.h | 20 +++---- src/object_api.c | 16 +++--- src/odb.c | 58 ++++++++++---------- src/odb.h | 14 ++--- src/odb_loose.c | 20 +++---- src/odb_mempack.c | 12 ++-- src/odb_pack.c | 6 +- src/pack-objects.c | 32 +++++------ src/pack-objects.h | 2 +- src/pack.c | 52 +++++++++--------- src/pack.h | 10 ++-- src/push.c | 12 ++-- src/reader.c | 2 +- src/rebase.c | 4 +- src/refdb_fs.c | 4 +- src/refs.c | 12 ++-- src/repository.c | 10 ++-- src/reset.c | 4 +- src/revert.c | 2 +- src/revparse.c | 36 ++++++------ src/revwalk.c | 4 +- src/settings.c | 2 +- src/submodule.c | 4 +- src/tag.c | 12 ++-- src/tag.h | 2 +- src/transports/local.c | 8 +-- src/tree.c | 24 ++++---- tests/checkout/binaryunicode.c | 4 +- tests/checkout/checkout_helpers.c | 2 +- tests/checkout/conflict.c | 2 +- tests/checkout/icase.c | 6 +- tests/checkout/tree.c | 44 +++++++-------- tests/checkout/typechange.c | 10 ++-- tests/cherrypick/workdir.c | 2 +- tests/clone/nonetwork.c | 2 +- tests/commit/parse.c | 6 +- tests/diff/diff_helpers.c | 4 +- tests/diff/rename.c | 2 +- tests/diff/workdir.c | 2 +- tests/filter/file.c | 2 +- tests/index/collision.c | 2 +- tests/index/filemodes.c | 2 +- tests/index/names.c | 2 +- tests/index/reuc.c | 2 +- tests/merge/trees/automerge.c | 2 +- tests/merge/trees/commits.c | 8 +-- tests/merge/workdir/dirty.c | 12 ++-- tests/object/blob/fromstream.c | 4 +- tests/object/cache.c | 52 +++++++++--------- tests/object/commit/parse.c | 4 +- tests/object/lookup.c | 18 +++--- tests/object/lookupbypath.c | 14 ++--- tests/object/peel.c | 92 +++++++++++++++---------------- tests/object/raw/data.h | 16 +++--- tests/object/raw/hash.c | 13 +++-- tests/object/raw/type2string.c | 58 ++++++++++---------- tests/object/raw/write.c | 16 +++--- tests/object/shortid.c | 8 +-- tests/object/tag/parse.c | 6 +- tests/object/tag/peel.c | 10 ++-- tests/object/tag/read.c | 6 +- tests/object/tag/write.c | 14 ++--- tests/object/tree/parse.c | 4 +- tests/object/tree/read.c | 4 +- tests/object/tree/walk.c | 2 +- tests/odb/backend/backend_helpers.c | 12 ++-- tests/odb/backend/mempack.c | 4 +- tests/odb/backend/nobackend.c | 2 +- tests/odb/backend/nonrefreshing.c | 12 ++-- tests/odb/emptyobjects.c | 4 +- tests/odb/foreach.c | 2 +- tests/odb/freshen.c | 4 +- tests/odb/largefiles.c | 12 ++-- tests/odb/loose.c | 10 ++-- tests/odb/mixed.c | 48 ++++++++-------- tests/odb/packed.c | 4 +- tests/odb/packed_one.c | 2 +- tests/odb/streamwrite.c | 2 +- tests/pack/indexer.c | 4 +- tests/pack/packbuilder.c | 2 +- tests/pack/sharing.c | 4 +- tests/rebase/merge.c | 2 +- tests/rebase/setup.c | 28 +++++----- tests/rebase/submodule.c | 2 +- tests/refs/branches/upstream.c | 4 +- tests/refs/peel.c | 76 +++++++++++++------------- tests/refs/read.c | 16 +++--- tests/refs/reflog/messages.c | 4 +- tests/repo/env.c | 12 ++-- tests/repo/hashfile.c | 38 ++++++------- tests/repo/head.c | 4 +- tests/reset/hard.c | 6 +- tests/reset/soft.c | 2 +- tests/revert/bare.c | 2 +- tests/revert/workdir.c | 8 +-- tests/revwalk/basic.c | 6 +- tests/revwalk/mergebase.c | 6 +- tests/stash/save.c | 18 +++--- tests/status/single.c | 4 +- tests/status/worktree.c | 2 +- tests/submodule/init.c | 2 +- tests/submodule/update.c | 8 +-- 122 files changed, 731 insertions(+), 728 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(¤t_id, repo, GIT_HEAD_FILE)) < 0) return error; - if ((error = git_object_lookup(&commit, repo, ¤t_id, GIT_OBJ_COMMIT)) < 0) + if ((error = git_object_lookup(&commit, repo, ¤t_id, GIT_OBJECT_COMMIT)) < 0) return error; /* The first step is to perform a describe of HEAD, so we can leverage this */ diff --git a/src/diff_file.c b/src/diff_file.c index b98995d21..b4ccec832 100644 --- a/src/diff_file.c +++ b/src/diff_file.c @@ -161,7 +161,7 @@ int git_diff_file_content__init_from_src( fc->flags |= GIT_DIFF_FLAG__FREE_BLOB; } else { fc->file->size = src->buflen; - git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJ_BLOB); + git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJECT_BLOB); fc->file->id_abbrev = GIT_OID_HEXSZ; fc->map.len = src->buflen; @@ -251,7 +251,7 @@ static int diff_file_content_load_blob( if (odb_obj != NULL) { error = git_object__from_odb_object( - (git_object **)&fc->blob, fc->repo, odb_obj, GIT_OBJ_BLOB); + (git_object **)&fc->blob, fc->repo, odb_obj, GIT_OBJECT_BLOB); git_odb_object_free(odb_obj); } else { error = git_blob_lookup( @@ -402,7 +402,7 @@ static int diff_file_content_load_workdir( /* once data is loaded, update OID if we didn't have it previously */ if (!error && (fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0) { error = git_odb_hash( - &fc->file->id, fc->map.data, fc->map.len, GIT_OBJ_BLOB); + &fc->file->id, fc->map.data, fc->map.len, GIT_OBJECT_BLOB); fc->file->flags |= GIT_DIFF_FLAG_VALID_ID; } diff --git a/src/diff_generate.c b/src/diff_generate.c index 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(¤t, repo, GIT_HEAD_FILE)) < 0) return error; - if ((error = git_object_lookup(&object, repo, id, GIT_OBJ_ANY)) < 0) + if ((error = git_object_lookup(&object, repo, id, GIT_OBJECT_ANY)) < 0) goto cleanup; - if ((error = git_object_peel(&peeled, object, GIT_OBJ_COMMIT)) < 0) + if ((error = git_object_peel(&peeled, object, GIT_OBJECT_COMMIT)) < 0) goto cleanup; if (new == NULL) @@ -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; diff --git a/tests/checkout/binaryunicode.c b/tests/checkout/binaryunicode.c index 27e70d3f1..5ba79213a 100644 --- a/tests/checkout/binaryunicode.c +++ b/tests/checkout/binaryunicode.c @@ -36,12 +36,12 @@ static void execute_test(void) /* Verify that the lenna.jpg file was checked out correctly */ cl_git_pass(git_oid_fromstr(&check, "8ab005d890fe53f65eda14b23672f60d9f4ec5a1")); - cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/lenna.jpg", GIT_OBJ_BLOB)); + cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/lenna.jpg", GIT_OBJECT_BLOB)); cl_assert_equal_oid(&oid, &check); /* Verify that the text file was checked out correctly */ cl_git_pass(git_oid_fromstr(&check, "965b223880dd4249e2c66a0cc0b4cffe1dc40f5a")); - cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/utf16_withbom_noeol_crlf.txt", GIT_OBJ_BLOB)); + cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/utf16_withbom_noeol_crlf.txt", GIT_OBJECT_BLOB)); cl_assert_equal_oid(&oid, &check); } diff --git a/tests/checkout/checkout_helpers.c b/tests/checkout/checkout_helpers.c index 144be6a38..cecee6aae 100644 --- a/tests/checkout/checkout_helpers.c +++ b/tests/checkout/checkout_helpers.c @@ -25,7 +25,7 @@ void reset_index_to_treeish(git_object *treeish) git_index *index; git_repository *repo = git_object_owner(treeish); - cl_git_pass(git_object_peel(&tree, treeish, GIT_OBJ_TREE)); + cl_git_pass(git_object_peel(&tree, treeish, GIT_OBJECT_TREE)); cl_git_pass(git_repository_index(&index, repo)); cl_git_pass(git_index_read_tree(index, (git_tree *)tree)); diff --git a/tests/checkout/conflict.c b/tests/checkout/conflict.c index abfd9b7c7..914b3c2de 100644 --- a/tests/checkout/conflict.c +++ b/tests/checkout/conflict.c @@ -156,7 +156,7 @@ static void ensure_workdir_oid(const char *path, const char *oid_str) git_oid expected, actual; cl_git_pass(git_oid_fromstr(&expected, oid_str)); - cl_git_pass(git_repository_hashfile(&actual, g_repo, path, GIT_OBJ_BLOB, NULL)); + cl_git_pass(git_repository_hashfile(&actual, g_repo, path, GIT_OBJECT_BLOB, NULL)); cl_assert_equal_oid(&expected, &actual); } diff --git a/tests/checkout/icase.c b/tests/checkout/icase.c index 4aa78a869..e6c640ef5 100644 --- a/tests/checkout/icase.c +++ b/tests/checkout/icase.c @@ -31,7 +31,7 @@ void test_checkout_icase__initialize(void) cl_skip(); cl_git_pass(git_reference_name_to_id(&id, repo, "refs/heads/dir")); - cl_git_pass(git_object_lookup(&obj, repo, &id, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, repo, &id, GIT_OBJECT_ANY)); git_checkout_init_options(&checkout_opts, GIT_CHECKOUT_OPTIONS_VERSION); checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE; @@ -273,7 +273,7 @@ void test_checkout_icase__conflicts_with_casechanged_subtrees(void) checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE; cl_git_pass(git_reference_lookup_resolved(&orig_ref, repo, "HEAD", 100)); - cl_git_pass(git_object_lookup(&orig, repo, git_reference_target(orig_ref), GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&orig, repo, git_reference_target(orig_ref), GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, (git_object *)orig, GIT_RESET_HARD, NULL)); cl_must_pass(p_mkdir("testrepo/AB", 0777)); @@ -281,7 +281,7 @@ void test_checkout_icase__conflicts_with_casechanged_subtrees(void) cl_git_write2file("testrepo/AB/C/3.txt", "Foobar!\n", 8, O_RDWR|O_CREAT, 0666); cl_git_pass(git_reference_name_to_id(&oid, repo, "refs/heads/subtrees")); - cl_git_pass(git_object_lookup(&subtrees, repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&subtrees, repo, &oid, GIT_OBJECT_ANY)); cl_git_fail(git_checkout_tree(repo, subtrees, &checkout_opts)); diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c index 039393d3f..47ded0f7c 100644 --- a/tests/checkout/tree.c +++ b/tests/checkout/tree.c @@ -170,7 +170,7 @@ void test_checkout_tree__can_switch_branches(void) opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir")); @@ -190,7 +190,7 @@ void test_checkout_tree__can_switch_branches(void) opts.checkout_strategy = GIT_CHECKOUT_SAFE; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/subtrees")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees")); @@ -260,7 +260,7 @@ static int checkout_tree_with_blob_ignored_in_workdir(int strategy, bool isdir) opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir")); @@ -300,7 +300,7 @@ static int checkout_tree_with_blob_ignored_in_workdir(int strategy, bool isdir) cl_assert_equal_i(1, ignored); cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/subtrees")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); error = git_checkout_tree(g_repo, obj, &opts); @@ -374,7 +374,7 @@ void test_checkout_tree__can_update_only(void) opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_UPDATE_ONLY; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); cl_git_pass(git_repository_set_head(g_repo, "refs/heads/dir")); @@ -541,7 +541,7 @@ void assert_conflict( /* Hack-ishy workaound to ensure *all* the index entries * match the content of the tree */ - cl_git_pass(git_object_peel(&hack_tree, g_object, GIT_OBJ_TREE)); + cl_git_pass(git_object_peel(&hack_tree, g_object, GIT_OBJECT_TREE)); cl_git_pass(git_index_read_tree(index, (git_tree *)hack_tree)); cl_git_pass(git_index_write(index)); git_object_free(hack_tree); @@ -676,7 +676,7 @@ void test_checkout_tree__can_cancel_checkout_from_notify(void) assert_on_branch(g_repo, "master"); cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); ca.filename = "new.txt"; ca.error = -5555; @@ -796,7 +796,7 @@ void test_checkout_tree__can_write_to_empty_dirs(void) opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); @@ -815,7 +815,7 @@ void test_checkout_tree__fails_when_dir_in_use(void) opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); @@ -826,7 +826,7 @@ void test_checkout_tree__fails_when_dir_in_use(void) cl_git_pass(p_chdir("testrepo/a")); cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/master")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_fail(git_checkout_tree(g_repo, obj, &opts)); @@ -849,7 +849,7 @@ void test_checkout_tree__can_continue_when_dir_in_use(void) GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); @@ -860,7 +860,7 @@ void test_checkout_tree__can_continue_when_dir_in_use(void) cl_git_pass(p_chdir("testrepo/a")); cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/master")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); @@ -892,7 +892,7 @@ void test_checkout_tree__target_directory_from_bare(void) opts.notify_payload = &cts; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD")); - cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_fail(git_checkout_tree(g_repo, g_object, &opts)); @@ -967,7 +967,7 @@ void test_checkout_tree__fails_when_conflicts_exist_in_index(void) opts.checkout_strategy = GIT_CHECKOUT_SAFE; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); create_conflict("conflicts.txt"); @@ -1287,7 +1287,7 @@ void test_checkout_tree__can_collect_perfdata(void) opts.checkout_strategy = GIT_CHECKOUT_FORCE; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/dir")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); @@ -1328,7 +1328,7 @@ void test_checkout_tree__caches_attributes_during_checkout(void) opts.paths.count = 2; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/ident")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); @@ -1363,7 +1363,7 @@ void test_checkout_tree__can_not_update_index(void) GIT_CHECKOUT_FORCE | GIT_CHECKOUT_DONT_UPDATE_INDEX; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD")); - cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts)); @@ -1400,7 +1400,7 @@ void test_checkout_tree__can_update_but_not_write_index(void) GIT_CHECKOUT_FORCE | GIT_CHECKOUT_DONT_WRITE_INDEX; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "HEAD")); - cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&head, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_reset(g_repo, head, GIT_RESET_HARD, &g_opts)); @@ -1446,7 +1446,7 @@ void test_checkout_tree__safe_proceeds_if_no_index(void) opts.checkout_strategy = GIT_CHECKOUT_SAFE; cl_git_pass(git_reference_name_to_id(&oid, g_repo, "refs/heads/subtrees")); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(g_repo, obj, &opts)); cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees")); @@ -1500,7 +1500,7 @@ void test_checkout_tree__baseline_is_empty_when_no_index(void) assert_on_branch(g_repo, "master"); cl_git_pass(git_repository_head(&head, g_repo)); - cl_git_pass(git_reference_peel(&obj, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&obj, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(g_repo, obj, GIT_RESET_HARD, NULL)); @@ -1539,7 +1539,7 @@ void test_checkout_tree__mode_change_is_force_updated(void) assert_on_branch(g_repo, "master"); cl_git_pass(git_repository_index(&index, g_repo)); cl_git_pass(git_repository_head(&head, g_repo)); - cl_git_pass(git_reference_peel(&obj, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&obj, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(g_repo, obj, GIT_RESET_HARD, NULL)); assert_status_entrycount(g_repo, 0); @@ -1602,7 +1602,7 @@ static void modify_index_and_checkout_tree(git_checkout_options *opts) /* External changes to the index are maintained by default */ cl_git_pass(git_repository_index(&index, g_repo)); cl_git_pass(git_repository_head(&head, g_repo)); - cl_git_pass(git_reference_peel(&obj, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&obj, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(g_repo, obj, GIT_RESET_HARD, NULL)); assert_status_entrycount(g_repo, 0); diff --git a/tests/checkout/typechange.c b/tests/checkout/typechange.c index 7299f8d33..708af5956 100644 --- a/tests/checkout/typechange.c +++ b/tests/checkout/typechange.c @@ -96,8 +96,8 @@ static void assert_workdir_matches_tree( root = git_repository_workdir(repo); cl_assert(root); - cl_git_pass(git_object_lookup(&obj, repo, id, GIT_OBJ_ANY)); - cl_git_pass(git_object_peel((git_object **)&tree, obj, GIT_OBJ_TREE)); + cl_git_pass(git_object_lookup(&obj, repo, id, GIT_OBJECT_ANY)); + cl_git_pass(git_object_peel((git_object **)&tree, obj, GIT_OBJECT_TREE)); git_object_free(obj); max_i = git_tree_entrycount(tree); @@ -109,16 +109,16 @@ static void assert_workdir_matches_tree( cl_git_pass(git_buf_joinpath(&path, root, git_tree_entry_name(te))); switch (git_tree_entry_type(te)) { - case GIT_OBJ_COMMIT: + case GIT_OBJECT_COMMIT: assert_dir_exists(path.ptr); break; - case GIT_OBJ_TREE: + case GIT_OBJECT_TREE: assert_dir_exists(path.ptr); if (recurse) assert_workdir_matches_tree( repo, git_tree_entry_id(te), path.ptr, true); break; - case GIT_OBJ_BLOB: + case GIT_OBJECT_BLOB: switch (git_tree_entry_filemode(te)) { case GIT_FILEMODE_BLOB: case GIT_FILEMODE_BLOB_EXECUTABLE: diff --git a/tests/cherrypick/workdir.c b/tests/cherrypick/workdir.c index e43bb0807..8f6644996 100644 --- a/tests/cherrypick/workdir.c +++ b/tests/cherrypick/workdir.c @@ -370,7 +370,7 @@ void test_cherrypick_workdir__nonmerge_fails_mainline_specified(void) git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT; cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJECT_COMMIT)); opts.mainline = 1; cl_must_fail(git_cherrypick(repo, commit, &opts)); diff --git a/tests/clone/nonetwork.c b/tests/clone/nonetwork.c index 9c3a1e510..8a8337c04 100644 --- a/tests/clone/nonetwork.c +++ b/tests/clone/nonetwork.c @@ -269,7 +269,7 @@ void test_clone_nonetwork__clone_tag_to_tree(void) memset(&entry, 0, sizeof(git_index_entry)); entry.path = file_path; entry.mode = GIT_FILEMODE_BLOB; - cl_git_pass(git_odb_write(&entry.id, odb, file_content, strlen(file_content), GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&entry.id, odb, file_content, strlen(file_content), GIT_OBJECT_BLOB)); cl_git_pass(git_index_add(index, &entry)); cl_git_pass(git_index_write_tree_to(&tree_id, index, stage)); diff --git a/tests/commit/parse.c b/tests/commit/parse.c index 47ec6ddbf..a5dcf8709 100644 --- a/tests/commit/parse.c +++ b/tests/commit/parse.c @@ -515,7 +515,7 @@ corrupt signature\n"; cl_git_pass(git_repository_odb__weakptr(&odb, g_repo)); - cl_git_pass(git_odb_write(&commit_id, odb, passing_commit_cases[4], strlen(passing_commit_cases[4]), GIT_OBJ_COMMIT)); + cl_git_pass(git_odb_write(&commit_id, odb, passing_commit_cases[4], strlen(passing_commit_cases[4]), GIT_OBJECT_COMMIT)); cl_git_pass(git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL)); cl_assert_equal_s(gpgsig, signature.ptr); @@ -534,14 +534,14 @@ corrupt signature\n"; cl_assert_equal_i(GITERR_INVALID, giterr_last()->klass); /* Try to parse an unsigned commit */ - cl_git_pass(git_odb_write(&commit_id, odb, passing_commit_cases[1], strlen(passing_commit_cases[1]), GIT_OBJ_COMMIT)); + cl_git_pass(git_odb_write(&commit_id, odb, passing_commit_cases[1], strlen(passing_commit_cases[1]), GIT_OBJECT_COMMIT)); cl_git_fail_with(GIT_ENOTFOUND, git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL)); cl_assert_equal_i(GITERR_OBJECT, giterr_last()->klass); /* Parse the commit with a single-line signature */ git_buf_clear(&signature); git_buf_clear(&signed_data); - cl_git_pass(git_odb_write(&commit_id, odb, oneline_signature, strlen(oneline_signature), GIT_OBJ_COMMIT)); + cl_git_pass(git_odb_write(&commit_id, odb, oneline_signature, strlen(oneline_signature), GIT_OBJECT_COMMIT)); cl_git_pass(git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL)); cl_assert_equal_s("bad", signature.ptr); cl_assert_equal_s(oneline_data, signed_data.ptr); diff --git a/tests/diff/diff_helpers.c b/tests/diff/diff_helpers.c index 50752b203..fdedd89ca 100644 --- a/tests/diff/diff_helpers.c +++ b/tests/diff/diff_helpers.c @@ -12,9 +12,9 @@ git_tree *resolve_commit_oid_to_tree( git_tree *tree = NULL; if (git_oid_fromstrn(&oid, partial_oid, len) == 0) - cl_git_pass(git_object_lookup_prefix(&obj, repo, &oid, len, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup_prefix(&obj, repo, &oid, len, GIT_OBJECT_ANY)); - cl_git_pass(git_object_peel((git_object **) &tree, obj, GIT_OBJ_TREE)); + cl_git_pass(git_object_peel((git_object **) &tree, obj, GIT_OBJECT_TREE)); git_object_free(obj); return tree; } diff --git a/tests/diff/rename.c b/tests/diff/rename.c index 0ba9330ac..2166ea521 100644 --- a/tests/diff/rename.c +++ b/tests/diff/rename.c @@ -418,7 +418,7 @@ void test_diff_rename__test_small_files(void) cl_git_pass(git_index_add_bypath(index, "small.txt")); cl_git_pass(git_repository_head(&head_reference, g_repo)); - cl_git_pass(git_reference_peel((git_object**)&head_commit, head_reference, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object**)&head_commit, head_reference, GIT_OBJECT_COMMIT)); cl_git_pass(git_commit_tree(&head_tree, head_commit)); cl_git_pass(git_index_write_tree(&oid, index)); cl_git_pass(git_tree_lookup(&commit_tree, g_repo, &oid)); diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c index b1d9aef60..f42121ff8 100644 --- a/tests/diff/workdir.c +++ b/tests/diff/workdir.c @@ -2016,7 +2016,7 @@ void test_diff_workdir__only_writes_index_when_necessary(void) cl_git_pass(git_repository_index(&index, g_repo)); cl_git_pass(git_repository_head(&head, g_repo)); - cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(g_repo, head_object, GIT_RESET_HARD, NULL)); diff --git a/tests/filter/file.c b/tests/filter/file.c index 8f8a58527..521c01c02 100644 --- a/tests/filter/file.c +++ b/tests/filter/file.c @@ -18,7 +18,7 @@ void test_filter_file__initialize(void) cl_repo_set_bool(g_repo, "core.autocrlf", true); cl_git_pass(git_repository_head(&head_ref, g_repo)); - cl_git_pass(git_reference_peel((git_object **)&head, head_ref, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head, head_ref, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(g_repo, (git_object *)head, GIT_RESET_HARD, NULL)); git_commit_free(head); diff --git a/tests/index/collision.c b/tests/index/collision.c index e9af2cfe4..18d2664f0 100644 --- a/tests/index/collision.c +++ b/tests/index/collision.c @@ -13,7 +13,7 @@ void test_index_collision__initialize(void) cl_git_pass(git_repository_odb(&g_odb, g_repo)); cl_git_pass(git_repository_index(&g_index, g_repo)); - cl_git_pass(git_odb_write(&g_empty_id, g_odb, "", 0, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&g_empty_id, g_odb, "", 0, GIT_OBJECT_BLOB)); } void test_index_collision__cleanup(void) diff --git a/tests/index/filemodes.c b/tests/index/filemodes.c index 4e5a6df3b..f2ca4564b 100644 --- a/tests/index/filemodes.c +++ b/tests/index/filemodes.c @@ -247,7 +247,7 @@ void test_index_filemodes__invalid(void) GIT_INDEX_ENTRY_STAGE_SET(&entry, 0); entry.path = "foo"; - entry.mode = GIT_OBJ_BLOB; + entry.mode = GIT_OBJECT_BLOB; git_oid_cpy(&entry.id, &dummy->id); cl_git_fail(git_index_add(index, &entry)); diff --git a/tests/index/names.c b/tests/index/names.c index e36a66740..369318b03 100644 --- a/tests/index/names.c +++ b/tests/index/names.c @@ -157,7 +157,7 @@ void test_index_names__cleaned_on_checkout_tree(void) test_index_names__add(); cl_git_pass(git_reference_name_to_id(&oid, repo, "refs/heads/master")); - cl_git_pass(git_object_lookup(&obj, repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(repo, obj, &opts)); cl_assert_equal_sz(0, git_index_name_entrycount(repo_index)); diff --git a/tests/index/reuc.c b/tests/index/reuc.c index 73eaf9ef0..1f95c4136 100644 --- a/tests/index/reuc.c +++ b/tests/index/reuc.c @@ -346,7 +346,7 @@ void test_index_reuc__cleaned_on_checkout_tree(void) test_index_reuc__add(); cl_git_pass(git_reference_name_to_id(&oid, repo, "refs/heads/master")); - cl_git_pass(git_object_lookup(&obj, repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, repo, &oid, GIT_OBJECT_ANY)); cl_git_pass(git_checkout_tree(repo, obj, &opts)); cl_assert(reuc_entry_exists() == false); diff --git a/tests/merge/trees/automerge.c b/tests/merge/trees/automerge.c index e16b829ee..e4efba51c 100644 --- a/tests/merge/trees/automerge.c +++ b/tests/merge/trees/automerge.c @@ -100,7 +100,7 @@ void test_merge_trees_automerge__automerge(void) cl_assert((entry = git_index_get_bypath(index, "automergeable.txt", 0)) != NULL); cl_assert(entry->file_size == strlen(AUTOMERGEABLE_MERGED_FILE)); - cl_git_pass(git_object_lookup((git_object **)&blob, repo, &entry->id, GIT_OBJ_BLOB)); + cl_git_pass(git_object_lookup((git_object **)&blob, repo, &entry->id, GIT_OBJECT_BLOB)); cl_assert(memcmp(git_blob_rawcontent(blob), AUTOMERGEABLE_MERGED_FILE, (size_t)entry->file_size) == 0); git_index_free(index); diff --git a/tests/merge/trees/commits.c b/tests/merge/trees/commits.c index 786a77a8b..79fba8ac5 100644 --- a/tests/merge/trees/commits.c +++ b/tests/merge/trees/commits.c @@ -62,7 +62,7 @@ void test_merge_trees_commits__automerge(void) cl_assert((entry = git_index_get_bypath(index, "automergeable.txt", 0)) != NULL); cl_assert(entry->file_size == strlen(AUTOMERGEABLE_MERGED_FILE)); - cl_git_pass(git_object_lookup((git_object **)&blob, repo, &entry->id, GIT_OBJ_BLOB)); + cl_git_pass(git_object_lookup((git_object **)&blob, repo, &entry->id, GIT_OBJECT_BLOB)); cl_assert(memcmp(git_blob_rawcontent(blob), AUTOMERGEABLE_MERGED_FILE, (size_t)entry->file_size) == 0); git_index_free(index); @@ -137,12 +137,12 @@ void test_merge_trees_commits__fail_on_conflict(void) opts.flags |= GIT_MERGE_FAIL_ON_CONFLICT; - cl_git_fail_with(GIT_EMERGECONFLICT, + cl_git_fail_with(GIT_EMERGECONFLICT, merge_trees_from_branches(&index, repo, "df_side1", "df_side2", &opts)); - cl_git_fail_with(GIT_EMERGECONFLICT, + cl_git_fail_with(GIT_EMERGECONFLICT, merge_commits_from_branches(&index, repo, "master", "unrelated", &opts)); - cl_git_fail_with(GIT_EMERGECONFLICT, + cl_git_fail_with(GIT_EMERGECONFLICT, merge_commits_from_branches(&index, repo, "master", "branch", &opts)); } diff --git a/tests/merge/workdir/dirty.c b/tests/merge/workdir/dirty.c index dd7267b61..6044bca43 100644 --- a/tests/merge/workdir/dirty.c +++ b/tests/merge/workdir/dirty.c @@ -201,7 +201,7 @@ static void stage_content(char *content[]) size_t i; cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL)); for (i = 0, filename = content[i], text = content[++i]; @@ -228,7 +228,7 @@ static int merge_dirty_files(char *dirty_files[]) int error; cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL)); write_files(dirty_files); @@ -248,7 +248,7 @@ static int merge_differently_filtered_files(char *files[]) int error; cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL)); /* Emulate checkout with a broken or misconfigured filter: modify some @@ -275,7 +275,7 @@ static int merge_differently_filtered_files(char *files[]) } static int merge_staged_files(char *staged_files[]) -{ +{ stage_random_files(staged_files); return merge_branch(); } @@ -295,7 +295,7 @@ void test_merge_workdir_dirty__unstaged_deletes_maintained(void) git_object *head_object; cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL)); cl_git_pass(p_unlink("merge-resolve/unchanged.txt")); @@ -333,7 +333,7 @@ void test_merge_workdir_dirty__identical_staged_files_allowed(void) size_t i; set_core_autocrlf_to(repo, false); - + for (i = 0, content = result_contents[i]; content[0]; content = result_contents[++i]) { stage_content(content); diff --git a/tests/object/blob/fromstream.c b/tests/object/blob/fromstream.c index 34b9f58d1..60090b6e4 100644 --- a/tests/object/blob/fromstream.c +++ b/tests/object/blob/fromstream.c @@ -27,7 +27,7 @@ void test_object_blob_fromstream__multiple_write(void) cl_git_pass(git_oid_fromstr(&expected_id, "321cbdf08803c744082332332838df6bd160f8f9")); cl_git_fail_with(GIT_ENOTFOUND, - git_object_lookup(&blob, repo, &expected_id, GIT_OBJ_ANY)); + git_object_lookup(&blob, repo, &expected_id, GIT_OBJECT_ANY)); cl_git_pass(git_blob_create_fromstream(&stream, repo, NULL)); @@ -37,7 +37,7 @@ void test_object_blob_fromstream__multiple_write(void) cl_git_pass(git_blob_create_fromstream_commit(&id, stream)); cl_assert_equal_oid(&expected_id, &id); - cl_git_pass(git_object_lookup(&blob, repo, &expected_id, GIT_OBJ_BLOB)); + cl_git_pass(git_object_lookup(&blob, repo, &expected_id, GIT_OBJECT_BLOB)); git_object_free(blob); } diff --git a/tests/object/cache.c b/tests/object/cache.c index 680f23630..d3ec53ac2 100644 --- a/tests/object/cache.c +++ b/tests/object/cache.c @@ -13,33 +13,33 @@ void test_object_cache__cleanup(void) git_repository_free(g_repo); g_repo = NULL; - git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJ_BLOB, (size_t)0); + git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJECT_BLOB, (size_t)0); } static struct { - git_otype type; + git_object_t type; const char *sha; } g_data[] = { /* HEAD */ - { GIT_OBJ_BLOB, "a8233120f6ad708f843d861ce2b7228ec4e3dec6" }, /* README */ - { GIT_OBJ_BLOB, "3697d64be941a53d4ae8f6a271e4e3fa56b022cc" }, /* branch_file.txt */ - { GIT_OBJ_BLOB, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd" }, /* new.txt */ + { GIT_OBJECT_BLOB, "a8233120f6ad708f843d861ce2b7228ec4e3dec6" }, /* README */ + { GIT_OBJECT_BLOB, "3697d64be941a53d4ae8f6a271e4e3fa56b022cc" }, /* branch_file.txt */ + { GIT_OBJECT_BLOB, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd" }, /* new.txt */ /* refs/heads/subtrees */ - { GIT_OBJ_BLOB, "1385f264afb75a56a5bec74243be9b367ba4ca08" }, /* README */ - { GIT_OBJ_TREE, "f1425cef211cc08caa31e7b545ffb232acb098c3" }, /* ab */ - { GIT_OBJ_BLOB, "d6c93164c249c8000205dd4ec5cbca1b516d487f" }, /* ab/4.txt */ - { GIT_OBJ_TREE, "9a03079b8a8ee85a0bee58bf9be3da8b62414ed4" }, /* ab/c */ - { GIT_OBJ_BLOB, "270b8ea76056d5cad83af921837702d3e3c2924d" }, /* ab/c/3.txt */ - { GIT_OBJ_TREE, "b6361fc6a97178d8fc8639fdeed71c775ab52593" }, /* ab/de */ - { GIT_OBJ_BLOB, "e7b4ad382349ff96dd8199000580b9b1e2042eb0" }, /* ab/de/2.txt */ - { GIT_OBJ_TREE, "3259a6bd5b57fb9c1281bb7ed3167b50f224cb54" }, /* ab/de/fgh */ - { GIT_OBJ_BLOB, "1f67fc4386b2d171e0d21be1c447e12660561f9b" }, /* ab/de/fgh/1.txt */ - { GIT_OBJ_BLOB, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057" }, /* branch_file.txt */ - { GIT_OBJ_BLOB, "fa49b077972391ad58037050f2a75f74e3671e92" }, /* new.txt */ + { GIT_OBJECT_BLOB, "1385f264afb75a56a5bec74243be9b367ba4ca08" }, /* README */ + { GIT_OBJECT_TREE, "f1425cef211cc08caa31e7b545ffb232acb098c3" }, /* ab */ + { GIT_OBJECT_BLOB, "d6c93164c249c8000205dd4ec5cbca1b516d487f" }, /* ab/4.txt */ + { GIT_OBJECT_TREE, "9a03079b8a8ee85a0bee58bf9be3da8b62414ed4" }, /* ab/c */ + { GIT_OBJECT_BLOB, "270b8ea76056d5cad83af921837702d3e3c2924d" }, /* ab/c/3.txt */ + { GIT_OBJECT_TREE, "b6361fc6a97178d8fc8639fdeed71c775ab52593" }, /* ab/de */ + { GIT_OBJECT_BLOB, "e7b4ad382349ff96dd8199000580b9b1e2042eb0" }, /* ab/de/2.txt */ + { GIT_OBJECT_TREE, "3259a6bd5b57fb9c1281bb7ed3167b50f224cb54" }, /* ab/de/fgh */ + { GIT_OBJECT_BLOB, "1f67fc4386b2d171e0d21be1c447e12660561f9b" }, /* ab/de/fgh/1.txt */ + { GIT_OBJECT_BLOB, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057" }, /* branch_file.txt */ + { GIT_OBJECT_BLOB, "fa49b077972391ad58037050f2a75f74e3671e92" }, /* new.txt */ /* refs/heads/chomped */ - { GIT_OBJ_BLOB, "0266163a49e280c4f5ed1e08facd36a2bd716bcf" }, /* readme.txt */ + { GIT_OBJECT_BLOB, "0266163a49e280c4f5ed1e08facd36a2bd716bcf" }, /* readme.txt */ { 0, NULL }, { 0, NULL } @@ -54,7 +54,7 @@ void test_object_cache__cache_everything(void) git_odb *odb; git_libgit2_opts( - GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJ_BLOB, (size_t)32767); + GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJECT_BLOB, (size_t)32767); cl_git_pass(git_repository_open(&g_repo, cl_fixture("testrepo.git"))); cl_git_pass(git_repository_odb(&odb, g_repo)); @@ -72,7 +72,7 @@ void test_object_cache__cache_everything(void) cl_assert(g_data[i].type == git_odb_object_type(odb_obj)); git_odb_object_free(odb_obj); } else { - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_assert(g_data[i].type == git_object_type(obj)); git_object_free(obj); } @@ -88,7 +88,7 @@ void test_object_cache__cache_everything(void) int count = (int)git_cache_size(&g_repo->objects); cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha)); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_assert(g_data[i].type == git_object_type(obj)); git_object_free(obj); @@ -104,7 +104,7 @@ void test_object_cache__cache_no_blobs(void) git_object *obj; git_odb *odb; - git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJ_BLOB, (size_t)0); + git_libgit2_opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, (int)GIT_OBJECT_BLOB, (size_t)0); cl_git_pass(git_repository_open(&g_repo, cl_fixture("testrepo.git"))); cl_git_pass(git_repository_odb(&odb, g_repo)); @@ -122,12 +122,12 @@ void test_object_cache__cache_no_blobs(void) cl_assert(g_data[i].type == git_odb_object_type(odb_obj)); git_odb_object_free(odb_obj); } else { - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_assert(g_data[i].type == git_object_type(obj)); git_object_free(obj); } - if (g_data[i].type == GIT_OBJ_BLOB) + if (g_data[i].type == GIT_OBJECT_BLOB) cl_assert_equal_i(count, (int)git_cache_size(&g_repo->objects)); else { cl_assert_equal_i(count + 1, (int)git_cache_size(&g_repo->objects)); @@ -148,14 +148,14 @@ static void *cache_parsed(void *arg) for (i = ((int *)arg)[1]; g_data[i].sha != NULL; i += 2) { cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha)); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_assert(g_data[i].type == git_object_type(obj)); git_object_free(obj); } for (i = 0; i < ((int *)arg)[1]; i += 2) { cl_git_pass(git_oid_fromstr(&oid, g_data[i].sha)); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_assert(g_data[i].type == git_object_type(obj)); git_object_free(obj); } @@ -246,7 +246,7 @@ static void *cache_quick(void *arg) git_object *obj; cl_git_pass(git_oid_fromstr(&oid, g_data[4].sha)); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); cl_assert(g_data[4].type == git_object_type(obj)); git_object_free(obj); diff --git a/tests/object/commit/parse.c b/tests/object/commit/parse.c index a99110f18..4ff1ad62a 100644 --- a/tests/object/commit/parse.c +++ b/tests/object/commit/parse.c @@ -14,7 +14,7 @@ static void assert_commit_parses(const char *data, size_t datalen, git_commit *commit; if (!datalen) datalen = strlen(data); - cl_git_pass(git_object__from_raw((git_object **) &commit, data, datalen, GIT_OBJ_COMMIT)); + cl_git_pass(git_object__from_raw((git_object **) &commit, data, datalen, GIT_OBJECT_COMMIT)); if (expected_author) { git_signature *author; @@ -65,7 +65,7 @@ static void assert_commit_fails(const char *data, size_t datalen) git_object *object; if (!datalen) datalen = strlen(data); - cl_git_fail(git_object__from_raw(&object, data, datalen, GIT_OBJ_COMMIT)); + cl_git_fail(git_object__from_raw(&object, data, datalen, GIT_OBJECT_COMMIT)); } void test_object_commit_parse__parsing_commit_succeeds(void) diff --git a/tests/object/lookup.c b/tests/object/lookup.c index 536c415e7..2458537fc 100644 --- a/tests/object/lookup.c +++ b/tests/object/lookup.c @@ -22,7 +22,7 @@ void test_object_lookup__lookup_wrong_type_returns_enotfound(void) cl_git_pass(git_oid_fromstr(&oid, commit)); cl_assert_equal_i( - GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJ_TAG)); + GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_TAG)); } void test_object_lookup__lookup_nonexisting_returns_enotfound(void) @@ -33,7 +33,7 @@ void test_object_lookup__lookup_nonexisting_returns_enotfound(void) cl_git_pass(git_oid_fromstr(&oid, unknown)); cl_assert_equal_i( - GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJ_ANY)); + GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_ANY)); } void test_object_lookup__lookup_wrong_type_by_abbreviated_id_returns_enotfound(void) @@ -44,7 +44,7 @@ void test_object_lookup__lookup_wrong_type_by_abbreviated_id_returns_enotfound(v cl_git_pass(git_oid_fromstrn(&oid, commit, strlen(commit))); cl_assert_equal_i( - GIT_ENOTFOUND, git_object_lookup_prefix(&object, g_repo, &oid, strlen(commit), GIT_OBJ_TAG)); + GIT_ENOTFOUND, git_object_lookup_prefix(&object, g_repo, &oid, strlen(commit), GIT_OBJECT_TAG)); } void test_object_lookup__lookup_wrong_type_eventually_returns_enotfound(void) @@ -55,11 +55,11 @@ void test_object_lookup__lookup_wrong_type_eventually_returns_enotfound(void) cl_git_pass(git_oid_fromstr(&oid, commit)); - cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT)); git_object_free(object); cl_assert_equal_i( - GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJ_TAG)); + GIT_ENOTFOUND, git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_TAG)); } void test_object_lookup__lookup_corrupt_object_returns_error(void) @@ -79,13 +79,13 @@ void test_object_lookup__lookup_corrupt_object_returns_error(void) for (i = 0; i < contents.size; i++) { contents.ptr[i] ^= 0x1; cl_git_pass(git_futils_writebuffer(&contents, path.ptr, O_RDWR, 0644)); - cl_git_fail(git_object_lookup(&object, g_repo, &oid, GIT_OBJ_COMMIT)); + cl_git_fail(git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT)); contents.ptr[i] ^= 0x1; } /* Restore original content and assert we can read the object */ cl_git_pass(git_futils_writebuffer(&contents, path.ptr, O_RDWR, 0644)); - cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT)); git_object_free(object); git_buf_dispose(&path); @@ -109,11 +109,11 @@ void test_object_lookup__lookup_object_with_wrong_hash_returns_error(void) cl_git_pass(git_futils_cp(oldpath.ptr, newpath.ptr, 0644)); /* Verify that lookup fails due to a hashsum mismatch */ - cl_git_fail_with(GIT_EMISMATCH, git_object_lookup(&object, g_repo, &oid, GIT_OBJ_COMMIT)); + cl_git_fail_with(GIT_EMISMATCH, git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT)); /* Disable verification and try again */ cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 0)); - cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&object, g_repo, &oid, GIT_OBJECT_COMMIT)); cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, 1)); git_object_free(object); diff --git a/tests/object/lookupbypath.c b/tests/object/lookupbypath.c index 15e79f6ec..f2257f556 100644 --- a/tests/object/lookupbypath.c +++ b/tests/object/lookupbypath.c @@ -16,11 +16,11 @@ void test_object_lookupbypath__initialize(void) cl_git_pass(git_repository_open(&g_repo, cl_fixture("attr/.gitted"))); cl_git_pass(git_repository_head(&head, g_repo)); - cl_git_pass(git_reference_peel((git_object**)&g_head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object**)&g_head_commit, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_commit_tree(&g_root_tree, g_head_commit)); cl_git_pass(git_tree_entry_bypath(&tree_entry, g_root_tree, "subdir/subdir_test2.txt")); cl_git_pass(git_object_lookup(&g_expectedobject, g_repo, git_tree_entry_id(tree_entry), - GIT_OBJ_ANY)); + GIT_OBJECT_ANY)); git_tree_entry_free(tree_entry); git_reference_free(head); @@ -42,16 +42,16 @@ void test_object_lookupbypath__errors(void) { cl_assert_equal_i(GIT_EINVALIDSPEC, git_object_lookup_bypath(&g_actualobject, (git_object*)g_root_tree, - "subdir/subdir_test2.txt", GIT_OBJ_TREE)); /* It's not a tree */ + "subdir/subdir_test2.txt", GIT_OBJECT_TREE)); /* It's not a tree */ cl_assert_equal_i(GIT_ENOTFOUND, git_object_lookup_bypath(&g_actualobject, (git_object*)g_root_tree, - "file/doesnt/exist", GIT_OBJ_ANY)); + "file/doesnt/exist", GIT_OBJECT_ANY)); } void test_object_lookupbypath__from_root_tree(void) { cl_git_pass(git_object_lookup_bypath(&g_actualobject, (git_object*)g_root_tree, - "subdir/subdir_test2.txt", GIT_OBJ_BLOB)); + "subdir/subdir_test2.txt", GIT_OBJECT_BLOB)); cl_assert_equal_oid(git_object_id(g_expectedobject), git_object_id(g_actualobject)); } @@ -59,7 +59,7 @@ void test_object_lookupbypath__from_root_tree(void) void test_object_lookupbypath__from_head_commit(void) { cl_git_pass(git_object_lookup_bypath(&g_actualobject, (git_object*)g_head_commit, - "subdir/subdir_test2.txt", GIT_OBJ_BLOB)); + "subdir/subdir_test2.txt", GIT_OBJECT_BLOB)); cl_assert_equal_oid(git_object_id(g_expectedobject), git_object_id(g_actualobject)); } @@ -73,7 +73,7 @@ void test_object_lookupbypath__from_subdir_tree(void) cl_git_pass(git_tree_lookup(&tree, g_repo, git_tree_entry_id(entry))); cl_git_pass(git_object_lookup_bypath(&g_actualobject, (git_object*)tree, - "subdir_test2.txt", GIT_OBJ_BLOB)); + "subdir_test2.txt", GIT_OBJECT_BLOB)); cl_assert_equal_oid(git_object_id(g_expectedobject), git_object_id(g_actualobject)); diff --git a/tests/object/peel.c b/tests/object/peel.c index 344885f1d..8be6e42d4 100644 --- a/tests/object/peel.c +++ b/tests/object/peel.c @@ -15,17 +15,17 @@ void test_object_peel__cleanup(void) static void assert_peel( const char *sha, - git_otype requested_type, + git_object_t requested_type, const char* expected_sha, - git_otype expected_type) + git_object_t expected_type) { git_oid oid, expected_oid; git_object *obj; git_object *peeled; cl_git_pass(git_oid_fromstr(&oid, sha)); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); - + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); + cl_git_pass(git_object_peel(&peeled, obj, requested_type)); cl_git_pass(git_oid_fromstr(&expected_oid, expected_sha)); @@ -37,15 +37,15 @@ static void assert_peel( git_object_free(obj); } -static void assert_peel_error(int error, const char *sha, git_otype requested_type) +static void assert_peel_error(int error, const char *sha, git_object_t requested_type) { git_oid oid; git_object *obj; git_object *peeled; cl_git_pass(git_oid_fromstr(&oid, sha)); - cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY)); - + cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJECT_ANY)); + cl_assert_equal_i(error, git_object_peel(&peeled, obj, requested_type)); git_object_free(obj); @@ -53,66 +53,66 @@ static void assert_peel_error(int error, const char *sha, git_otype requested_ty void test_object_peel__peeling_an_object_into_its_own_type_returns_another_instance_of_it(void) { - assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT, - "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT); - assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_TAG, - "7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_TAG); - assert_peel("53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE, - "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE); - assert_peel("0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_BLOB, - "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_BLOB); + assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT, + "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT); + assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_TAG, + "7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_TAG); + assert_peel("53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE, + "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE); + assert_peel("0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_BLOB, + "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_BLOB); } void test_object_peel__tag(void) { - assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_COMMIT, - "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT); - assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_TREE, - "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE); - assert_peel_error(GIT_EPEEL, "7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_BLOB); - assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_ANY, - "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT); + assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_COMMIT, + "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT); + assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_TREE, + "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE); + assert_peel_error(GIT_EPEEL, "7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_BLOB); + assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_ANY, + "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT); } void test_object_peel__commit(void) { - assert_peel_error(GIT_EINVALIDSPEC, "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_BLOB); - assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_TREE, - "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE); - assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT, - "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT); - assert_peel_error(GIT_EINVALIDSPEC, "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_TAG); - assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_ANY, - "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE); + assert_peel_error(GIT_EINVALIDSPEC, "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_BLOB); + assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_TREE, + "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE); + assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT, + "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT); + assert_peel_error(GIT_EINVALIDSPEC, "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_TAG); + assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_ANY, + "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE); } void test_object_peel__tree(void) { - assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_BLOB); - assert_peel("53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE, - "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE); - assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_COMMIT); - assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TAG); - assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_ANY); + assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_BLOB); + assert_peel("53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE, + "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE); + assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_COMMIT); + assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TAG); + assert_peel_error(GIT_EINVALIDSPEC, "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_ANY); } void test_object_peel__blob(void) { - assert_peel("0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_BLOB, - "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_BLOB); - assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_TREE); - assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_COMMIT); - assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_TAG); - assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJ_ANY); + assert_peel("0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_BLOB, + "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_BLOB); + assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_TREE); + assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_COMMIT); + assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_TAG); + assert_peel_error(GIT_EINVALIDSPEC, "0266163a49e280c4f5ed1e08facd36a2bd716bcf", GIT_OBJECT_ANY); } void test_object_peel__target_any_object_for_type_change(void) { /* tag to commit */ - assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJ_ANY, - "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT); + assert_peel("7b4384978d2493e851f9cca7858815fac9b10980", GIT_OBJECT_ANY, + "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT); /* commit to tree */ - assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_ANY, - "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE); + assert_peel("e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_ANY, + "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE); } diff --git a/tests/object/raw/data.h b/tests/object/raw/data.h index cf23819f1..07ace60fc 100644 --- a/tests/object/raw/data.h +++ b/tests/object/raw/data.h @@ -277,47 +277,47 @@ static char *some_id = "fd8430bc864cfcd5f10e5590f8a447e01b942bfe"; static git_rawobj tree_obj = { tree_data, sizeof(tree_data), - GIT_OBJ_TREE + GIT_OBJECT_TREE }; static git_rawobj tag_obj = { tag_data, sizeof(tag_data), - GIT_OBJ_TAG + GIT_OBJECT_TAG }; static git_rawobj zero_obj = { zero_data, 0, - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; static git_rawobj one_obj = { one_data, sizeof(one_data), - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; static git_rawobj two_obj = { two_data, sizeof(two_data), - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; static git_rawobj commit_obj = { commit_data, sizeof(commit_data), - GIT_OBJ_COMMIT + GIT_OBJECT_COMMIT }; static git_rawobj some_obj = { some_data, sizeof(some_data), - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; static git_rawobj junk_obj = { NULL, 0, - GIT_OBJ_BAD + GIT_OBJECT_BAD }; diff --git a/tests/object/raw/hash.c b/tests/object/raw/hash.c index ede31e145..830f1caa1 100644 --- a/tests/object/raw/hash.c +++ b/tests/object/raw/hash.c @@ -80,20 +80,23 @@ void test_object_raw_hash__hash_junk_data(void) junk_obj.data = some_data; hash_object_fail(&id, &junk_obj); - junk_obj.type = GIT_OBJ__EXT1; + junk_obj.type = 0; /* EXT1 */ hash_object_fail(&id, &junk_obj); - junk_obj.type = GIT_OBJ__EXT2; + junk_obj.type = 5; /* EXT2 */ hash_object_fail(&id, &junk_obj); - junk_obj.type = GIT_OBJ_OFS_DELTA; + junk_obj.type = GIT_OBJECT_OFS_DELTA; hash_object_fail(&id, &junk_obj); - junk_obj.type = GIT_OBJ_REF_DELTA; + junk_obj.type = GIT_OBJECT_REF_DELTA; + hash_object_fail(&id, &junk_obj); + + junk_obj.type = 42; hash_object_fail(&id, &junk_obj); /* data can be NULL only if len is zero: */ - junk_obj.type = GIT_OBJ_BLOB; + junk_obj.type = GIT_OBJECT_BLOB; junk_obj.data = NULL; hash_object_pass(&id, &junk_obj); cl_assert(git_oid_cmp(&id, &id_zero) == 0); diff --git a/tests/object/raw/type2string.c b/tests/object/raw/type2string.c index a3585487f..0c2070500 100644 --- a/tests/object/raw/type2string.c +++ b/tests/object/raw/type2string.c @@ -6,15 +6,15 @@ void test_object_raw_type2string__convert_type_to_string(void) { - cl_assert_equal_s(git_object_type2string(GIT_OBJ_BAD), ""); - cl_assert_equal_s(git_object_type2string(GIT_OBJ__EXT1), ""); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_COMMIT), "commit"); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_TREE), "tree"); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_BLOB), "blob"); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_TAG), "tag"); - cl_assert_equal_s(git_object_type2string(GIT_OBJ__EXT2), ""); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA"); - cl_assert_equal_s(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA"); + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_BAD), ""); + cl_assert_equal_s(git_object_type2string(0), ""); /* EXT1 */ + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_COMMIT), "commit"); + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_TREE), "tree"); + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_BLOB), "blob"); + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_TAG), "tag"); + cl_assert_equal_s(git_object_type2string(5), ""); /* EXT2 */ + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_OFS_DELTA), "OFS_DELTA"); + cl_assert_equal_s(git_object_type2string(GIT_OBJECT_REF_DELTA), "REF_DELTA"); cl_assert_equal_s(git_object_type2string(-2), ""); cl_assert_equal_s(git_object_type2string(8), ""); @@ -23,30 +23,30 @@ void test_object_raw_type2string__convert_type_to_string(void) void test_object_raw_type2string__convert_string_to_type(void) { - cl_assert(git_object_string2type(NULL) == GIT_OBJ_BAD); - cl_assert(git_object_string2type("") == GIT_OBJ_BAD); - cl_assert(git_object_string2type("commit") == GIT_OBJ_COMMIT); - cl_assert(git_object_string2type("tree") == GIT_OBJ_TREE); - cl_assert(git_object_string2type("blob") == GIT_OBJ_BLOB); - cl_assert(git_object_string2type("tag") == GIT_OBJ_TAG); - cl_assert(git_object_string2type("OFS_DELTA") == GIT_OBJ_OFS_DELTA); - cl_assert(git_object_string2type("REF_DELTA") == GIT_OBJ_REF_DELTA); - - cl_assert(git_object_string2type("CoMmIt") == GIT_OBJ_BAD); - cl_assert(git_object_string2type("hohoho") == GIT_OBJ_BAD); + cl_assert(git_object_string2type(NULL) == GIT_OBJECT_BAD); + cl_assert(git_object_string2type("") == GIT_OBJECT_BAD); + cl_assert(git_object_string2type("commit") == GIT_OBJECT_COMMIT); + cl_assert(git_object_string2type("tree") == GIT_OBJECT_TREE); + cl_assert(git_object_string2type("blob") == GIT_OBJECT_BLOB); + cl_assert(git_object_string2type("tag") == GIT_OBJECT_TAG); + cl_assert(git_object_string2type("OFS_DELTA") == GIT_OBJECT_OFS_DELTA); + cl_assert(git_object_string2type("REF_DELTA") == GIT_OBJECT_REF_DELTA); + + cl_assert(git_object_string2type("CoMmIt") == GIT_OBJECT_BAD); + cl_assert(git_object_string2type("hohoho") == GIT_OBJECT_BAD); } void test_object_raw_type2string__check_type_is_loose(void) { - cl_assert(git_object_typeisloose(GIT_OBJ_BAD) == 0); - cl_assert(git_object_typeisloose(GIT_OBJ__EXT1) == 0); - cl_assert(git_object_typeisloose(GIT_OBJ_COMMIT) == 1); - cl_assert(git_object_typeisloose(GIT_OBJ_TREE) == 1); - cl_assert(git_object_typeisloose(GIT_OBJ_BLOB) == 1); - cl_assert(git_object_typeisloose(GIT_OBJ_TAG) == 1); - cl_assert(git_object_typeisloose(GIT_OBJ__EXT2) == 0); - cl_assert(git_object_typeisloose(GIT_OBJ_OFS_DELTA) == 0); - cl_assert(git_object_typeisloose(GIT_OBJ_REF_DELTA) == 0); + cl_assert(git_object_typeisloose(GIT_OBJECT_BAD) == 0); + cl_assert(git_object_typeisloose(0) == 0); /* EXT1 */ + cl_assert(git_object_typeisloose(GIT_OBJECT_COMMIT) == 1); + cl_assert(git_object_typeisloose(GIT_OBJECT_TREE) == 1); + cl_assert(git_object_typeisloose(GIT_OBJECT_BLOB) == 1); + cl_assert(git_object_typeisloose(GIT_OBJECT_TAG) == 1); + cl_assert(git_object_typeisloose(5) == 0); /* EXT2 */ + cl_assert(git_object_typeisloose(GIT_OBJECT_OFS_DELTA) == 0); + cl_assert(git_object_typeisloose(GIT_OBJECT_REF_DELTA) == 0); cl_assert(git_object_typeisloose(-2) == 0); cl_assert(git_object_typeisloose(8) == 0); diff --git a/tests/object/raw/write.c b/tests/object/raw/write.c index c7270e26a..a360f04c5 100644 --- a/tests/object/raw/write.c +++ b/tests/object/raw/write.c @@ -58,7 +58,7 @@ static void make_odb_dir(void) /* Standard test form */ -void test_body(object_data *d, git_rawobj *o) +void test_body(object_data *d, git_rawobj *o) { git_odb *db; git_oid id1, id2; @@ -146,7 +146,7 @@ void test_object_raw_write__loose_object(void) git_rawobj commit_obj = { commit_data, sizeof(commit_data), - GIT_OBJ_COMMIT + GIT_OBJECT_COMMIT }; test_body(&commit, &commit_obj); @@ -182,7 +182,7 @@ void test_object_raw_write__loose_tree(void) static git_rawobj tree_obj = { tree_data, sizeof(tree_data), - GIT_OBJ_TREE + GIT_OBJECT_TREE }; test_body(&tree, &tree_obj); @@ -224,7 +224,7 @@ void test_object_raw_write__loose_tag(void) static git_rawobj tag_obj = { tag_data, sizeof(tag_data), - GIT_OBJ_TAG + GIT_OBJECT_TAG }; @@ -246,7 +246,7 @@ void test_object_raw_write__zero_length(void) static git_rawobj zero_obj = { zero_data, 0, - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; test_body(&zero, &zero_obj); @@ -267,7 +267,7 @@ void test_object_raw_write__one_byte(void) static git_rawobj one_obj = { one_data, sizeof(one_data), - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; test_body(&one, &one_obj); @@ -288,7 +288,7 @@ void test_object_raw_write__two_byte(void) static git_rawobj two_obj = { two_data, sizeof(two_data), - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; test_body(&two, &two_obj); @@ -455,7 +455,7 @@ void test_object_raw_write__several_bytes(void) static git_rawobj some_obj = { some_data, sizeof(some_data), - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }; test_body(&some, &some_obj); diff --git a/tests/object/shortid.c b/tests/object/shortid.c index 5c5990a6b..9b673efeb 100644 --- a/tests/object/shortid.c +++ b/tests/object/shortid.c @@ -20,28 +20,28 @@ void test_object_shortid__select(void) git_buf shorty = {0}; git_oid_fromstr(&full, "ce013625030ba8dba906f756967f9e9ca394464a"); - cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY)); cl_git_pass(git_object_short_id(&shorty, obj)); cl_assert_equal_i(7, shorty.size); cl_assert_equal_s("ce01362", shorty.ptr); git_object_free(obj); git_oid_fromstr(&full, "038d718da6a1ebbc6a7780a96ed75a70cc2ad6e2"); - cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY)); cl_git_pass(git_object_short_id(&shorty, obj)); cl_assert_equal_i(7, shorty.size); cl_assert_equal_s("038d718", shorty.ptr); git_object_free(obj); git_oid_fromstr(&full, "dea509d097ce692e167dfc6a48a7a280cc5e877e"); - cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY)); cl_git_pass(git_object_short_id(&shorty, obj)); cl_assert_equal_i(9, shorty.size); cl_assert_equal_s("dea509d09", shorty.ptr); git_object_free(obj); git_oid_fromstr(&full, "dea509d0b3cb8ee0650f6ca210bc83f4678851ba"); - cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, _repo, &full, GIT_OBJECT_ANY)); cl_git_pass(git_object_short_id(&shorty, obj)); cl_assert_equal_i(9, shorty.size); cl_assert_equal_s("dea509d0b", shorty.ptr); diff --git a/tests/object/tag/parse.c b/tests/object/tag/parse.c index f701f6b89..22535a025 100644 --- a/tests/object/tag/parse.c +++ b/tests/object/tag/parse.c @@ -14,8 +14,8 @@ static void assert_tag_parses(const char *data, size_t datalen, if (!datalen) datalen = strlen(data); - cl_git_pass(git_object__from_raw((git_object **) &tag, data, datalen, GIT_OBJ_TAG)); - cl_assert_equal_i(tag->type, GIT_OBJ_TAG); + cl_git_pass(git_object__from_raw((git_object **) &tag, data, datalen, GIT_OBJECT_TAG)); + cl_assert_equal_i(tag->type, GIT_OBJECT_TAG); if (expected_oid) { git_oid oid; @@ -54,7 +54,7 @@ static void assert_tag_fails(const char *data, size_t datalen) git_object *object; if (!datalen) datalen = strlen(data); - cl_git_fail(git_object__from_raw(&object, data, datalen, GIT_OBJ_TAG)); + cl_git_fail(git_object__from_raw(&object, data, datalen, GIT_OBJECT_TAG)); } void test_object_tag_parse__valid_tag_parses(void) diff --git a/tests/object/tag/peel.c b/tests/object/tag/peel.c index e2cd8d6a8..7456a8e17 100644 --- a/tests/object/tag/peel.c +++ b/tests/object/tag/peel.c @@ -28,7 +28,7 @@ void test_object_tag_peel__cleanup(void) static void retrieve_tag_from_oid(git_tag **tag_out, git_repository *repo, const char *sha) { git_oid oid; - + cl_git_pass(git_oid_fromstr(&oid, sha)); cl_git_pass(git_tag_lookup(tag_out, repo, &oid)); } @@ -38,7 +38,7 @@ void test_object_tag_peel__can_peel_to_a_commit(void) retrieve_tag_from_oid(&tag, repo, "7b4384978d2493e851f9cca7858815fac9b10980"); cl_git_pass(git_tag_peel(&target, tag)); - cl_assert(git_object_type(target) == GIT_OBJ_COMMIT); + cl_assert(git_object_type(target) == GIT_OBJECT_COMMIT); cl_git_pass(git_oid_streq(git_object_id(target), "e90810b8df3e80c413d903f631643c716887138d")); } @@ -47,7 +47,7 @@ void test_object_tag_peel__can_peel_several_nested_tags_to_a_commit(void) retrieve_tag_from_oid(&tag, repo, "b25fa35b38051e4ae45d4222e795f9df2e43f1d1"); cl_git_pass(git_tag_peel(&target, tag)); - cl_assert(git_object_type(target) == GIT_OBJ_COMMIT); + cl_assert(git_object_type(target) == GIT_OBJECT_COMMIT); cl_git_pass(git_oid_streq(git_object_id(target), "e90810b8df3e80c413d903f631643c716887138d")); } @@ -56,6 +56,6 @@ void test_object_tag_peel__can_peel_to_a_non_commit(void) retrieve_tag_from_oid(&tag, repo, "521d87c1ec3aef9824daf6d96cc0ae3710766d91"); cl_git_pass(git_tag_peel(&target, tag)); - cl_assert(git_object_type(target) == GIT_OBJ_BLOB); - cl_git_pass(git_oid_streq(git_object_id(target), "1385f264afb75a56a5bec74243be9b367ba4ca08")); + cl_assert(git_object_type(target) == GIT_OBJECT_BLOB); + cl_git_pass(git_oid_streq(git_object_id(target), "1385f264afb75a56a5bec74243be9b367ba4ca08")); } diff --git a/tests/object/tag/read.c b/tests/object/tag/read.c index e28056ec7..90ba58029 100644 --- a/tests/object/tag/read.c +++ b/tests/object/tag/read.c @@ -39,7 +39,7 @@ void test_object_tag_read__parse(void) cl_git_pass(git_tag_lookup(&tag1, g_repo, &id1)); cl_assert_equal_s(git_tag_name(tag1), "test"); - cl_assert(git_tag_target_type(tag1) == GIT_OBJ_TAG); + cl_assert(git_tag_target_type(tag1) == GIT_OBJECT_TAG); cl_git_pass(git_tag_target((git_object **)&tag2, tag1)); cl_assert(tag2 != NULL); @@ -132,7 +132,7 @@ void test_object_tag_read__without_tagger_nor_message(void) cl_git_pass(git_tag_lookup(&tag, repo, &id)); cl_assert_equal_s(git_tag_name(tag), "taggerless"); - cl_assert(git_tag_target_type(tag) == GIT_OBJ_COMMIT); + cl_assert(git_tag_target_type(tag) == GIT_OBJECT_COMMIT); cl_assert(tag->message == NULL); cl_assert(tag->tagger == NULL); @@ -170,7 +170,7 @@ void test_object_tag_read__extra_header_fields(void) cl_git_pass(git_repository_odb__weakptr(&odb, g_repo)); - cl_git_pass(git_odb_write(&id, odb, silly_tag, strlen(silly_tag), GIT_OBJ_TAG)); + cl_git_pass(git_odb_write(&id, odb, silly_tag, strlen(silly_tag), GIT_OBJECT_TAG)); cl_git_pass(git_tag_lookup(&tag, g_repo, &id)); cl_assert_equal_s("v1_0_1 release\n", git_tag_message(tag)); diff --git a/tests/object/tag/write.c b/tests/object/tag/write.c index 4c5080185..48c8bfd36 100644 --- a/tests/object/tag/write.c +++ b/tests/object/tag/write.c @@ -31,7 +31,7 @@ void test_object_tag_write__basic(void) git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); /* create signature */ cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60)); @@ -73,7 +73,7 @@ void test_object_tag_write__overwrite(void) git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); /* create signature */ cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60)); @@ -100,7 +100,7 @@ void test_object_tag_write__replace(void) git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/e90810b")); git_oid_cpy(&old_tag_id, git_reference_target(ref_tag)); @@ -136,7 +136,7 @@ void test_object_tag_write__lightweight(void) git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_tag_create_lightweight( &object_id, @@ -164,7 +164,7 @@ void test_object_tag_write__lightweight_over_existing(void) git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); cl_assert_equal_i(GIT_EEXISTS, git_tag_create_lightweight( &object_id, @@ -198,7 +198,7 @@ void test_object_tag_write__creating_with_an_invalid_name_returns_EINVALIDSPEC(v git_object *target; git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60)); @@ -230,7 +230,7 @@ void create_annotation(git_oid *tag_id, const char *name) cl_git_pass(git_signature_new(&tagger, tagger_name, tagger_email, 123456789, 60)); git_oid_fromstr(&target_id, tagged_commit); - cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&target, g_repo, &target_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_tag_annotation_create(tag_id, g_repo, name, target, tagger, "boom!")); git_object_free(target); diff --git a/tests/object/tree/parse.c b/tests/object/tree/parse.c index 83d22193d..1ab01c820 100644 --- a/tests/object/tree/parse.c +++ b/tests/object/tree/parse.c @@ -26,7 +26,7 @@ static void assert_tree_parses(const char *data, size_t datalen, if (!datalen) datalen = strlen(data); - cl_git_pass(git_object__from_raw((git_object **) &tree, data, datalen, GIT_OBJ_TREE)); + cl_git_pass(git_object__from_raw((git_object **) &tree, data, datalen, GIT_OBJECT_TREE)); cl_assert_equal_i(git_tree_entrycount(tree), expected_nentries); @@ -51,7 +51,7 @@ static void assert_tree_fails(const char *data, size_t datalen) git_object *object; if (!datalen) datalen = strlen(data); - cl_git_fail(git_object__from_raw(&object, data, datalen, GIT_OBJ_TREE)); + cl_git_fail(git_object__from_raw(&object, data, datalen, GIT_OBJECT_TREE)); } void test_object_tree_parse__single_blob_parses(void) diff --git a/tests/object/tree/read.c b/tests/object/tree/read.c index 1d3a9133d..a0eae11d1 100644 --- a/tests/object/tree/read.c +++ b/tests/object/tree/read.c @@ -55,11 +55,11 @@ void test_object_tree_read__two(void) cl_assert(git_tree_entrycount(tree) == 3); /* GH-86: git_object_lookup() should also check the type if the object comes from the cache */ - cl_assert(git_object_lookup(&obj, g_repo, &id, GIT_OBJ_TREE) == 0); + cl_assert(git_object_lookup(&obj, g_repo, &id, GIT_OBJECT_TREE) == 0); cl_assert(obj != NULL); git_object_free(obj); obj = NULL; - cl_git_fail(git_object_lookup(&obj, g_repo, &id, GIT_OBJ_BLOB)); + cl_git_fail(git_object_lookup(&obj, g_repo, &id, GIT_OBJECT_BLOB)); cl_assert(obj == NULL); entry = git_tree_entry_byname(tree, "README"); diff --git a/tests/object/tree/walk.c b/tests/object/tree/walk.c index f8005e579..d1fdaa3a0 100644 --- a/tests/object/tree/walk.c +++ b/tests/object/tree/walk.c @@ -118,7 +118,7 @@ static int treewalk_skip_de_cb( GIT_UNUSED(root); - if (git_tree_entry_type(entry) == GIT_OBJ_TREE) + if (git_tree_entry_type(entry) == GIT_OBJECT_TREE) data->dirs++; else data->files++; diff --git a/tests/odb/backend/backend_helpers.c b/tests/odb/backend/backend_helpers.c index 37a8fd200..c0f4103f1 100644 --- a/tests/odb/backend/backend_helpers.c +++ b/tests/odb/backend/backend_helpers.c @@ -58,7 +58,7 @@ static int fake_backend__exists_prefix( } static int fake_backend__read( - void **buffer_p, size_t *len_p, git_otype *type_p, + void **buffer_p, size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid) { const fake_object *obj; @@ -74,13 +74,13 @@ static int fake_backend__read( *len_p = strlen(obj->content); *buffer_p = git__strdup(obj->content); - *type_p = GIT_OBJ_BLOB; + *type_p = GIT_OBJECT_BLOB; return 0; } static int fake_backend__read_header( - size_t *len_p, git_otype *type_p, + size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid) { const fake_object *obj; @@ -95,13 +95,13 @@ static int fake_backend__read_header( return error; *len_p = strlen(obj->content); - *type_p = GIT_OBJ_BLOB; + *type_p = GIT_OBJECT_BLOB; return 0; } static int fake_backend__read_prefix( - git_oid *out_oid, void **buffer_p, size_t *len_p, git_otype *type_p, + git_oid *out_oid, void **buffer_p, size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *short_oid, size_t len) { const fake_object *obj; @@ -118,7 +118,7 @@ static int fake_backend__read_prefix( git_oid_fromstr(out_oid, obj->oid); *len_p = strlen(obj->content); *buffer_p = git__strdup(obj->content); - *type_p = GIT_OBJ_BLOB; + *type_p = GIT_OBJECT_BLOB; return 0; } diff --git a/tests/odb/backend/mempack.c b/tests/odb/backend/mempack.c index 624f0e604..55cd69f80 100644 --- a/tests/odb/backend/mempack.c +++ b/tests/odb/backend/mempack.c @@ -28,7 +28,7 @@ void test_odb_backend_mempack__cleanup(void) void test_odb_backend_mempack__write_succeeds(void) { const char *data = "data"; - cl_git_pass(git_odb_write(&_oid, _odb, data, strlen(data) + 1, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&_oid, _odb, data, strlen(data) + 1, GIT_OBJECT_BLOB)); cl_git_pass(git_odb_read(&_obj, _odb, &_oid)); } @@ -47,7 +47,7 @@ void test_odb_backend_mempack__exists_of_missing_object_fails(void) void test_odb_backend_mempack__exists_with_existing_objects_succeeds(void) { const char *data = "data"; - cl_git_pass(git_odb_write(&_oid, _odb, data, strlen(data) + 1, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&_oid, _odb, data, strlen(data) + 1, GIT_OBJECT_BLOB)); cl_assert(git_odb_exists(_odb, &_oid) == 1); } diff --git a/tests/odb/backend/nobackend.c b/tests/odb/backend/nobackend.c index 3c4f344b1..cd727b7c4 100644 --- a/tests/odb/backend/nobackend.c +++ b/tests/odb/backend/nobackend.c @@ -37,7 +37,7 @@ void test_odb_backend_nobackend__write_fails_gracefully(void) const git_error *err; git_repository_odb(&odb, _repo); - cl_git_fail(git_odb_write(&id, odb, "Hello world!\n", 13, GIT_OBJ_BLOB)); + cl_git_fail(git_odb_write(&id, odb, "Hello world!\n", 13, GIT_OBJECT_BLOB)); err = giterr_last(); cl_assert_equal_s(err->message, "cannot write object - unsupported in the loaded odb backends"); diff --git a/tests/odb/backend/nonrefreshing.c b/tests/odb/backend/nonrefreshing.c index 6abc0c6d2..ede48ade6 100644 --- a/tests/odb/backend/nonrefreshing.c +++ b/tests/odb/backend/nonrefreshing.c @@ -58,7 +58,7 @@ void test_odb_backend_nonrefreshing__read_is_invoked_once_on_failure(void) git_object *obj; cl_git_fail_with( - git_object_lookup(&obj, _repo, &_nonexisting_oid, GIT_OBJ_ANY), + git_object_lookup(&obj, _repo, &_nonexisting_oid, GIT_OBJECT_ANY), GIT_ENOTFOUND); cl_assert_equal_i(1, _fake->read_calls); @@ -69,7 +69,7 @@ void test_odb_backend_nonrefreshing__readprefix_is_invoked_once_on_failure(void) git_object *obj; cl_git_fail_with( - git_object_lookup_prefix(&obj, _repo, &_nonexisting_oid, 7, GIT_OBJ_ANY), + git_object_lookup_prefix(&obj, _repo, &_nonexisting_oid, 7, GIT_OBJECT_ANY), GIT_ENOTFOUND); cl_assert_equal_i(1, _fake->read_prefix_calls); @@ -79,7 +79,7 @@ void test_odb_backend_nonrefreshing__readheader_is_invoked_once_on_failure(void) { git_odb *odb; size_t len; - git_otype type; + git_object_t type; cl_git_pass(git_repository_odb__weakptr(&odb, _repo)); @@ -104,7 +104,7 @@ void test_odb_backend_nonrefreshing__read_is_invoked_once_on_success(void) { git_object *obj; - cl_git_pass(git_object_lookup(&obj, _repo, &_existing_oid, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj, _repo, &_existing_oid, GIT_OBJECT_ANY)); cl_assert_equal_i(1, _fake->read_calls); @@ -115,7 +115,7 @@ void test_odb_backend_nonrefreshing__readprefix_is_invoked_once_on_success(void) { git_object *obj; - cl_git_pass(git_object_lookup_prefix(&obj, _repo, &_existing_oid, 7, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup_prefix(&obj, _repo, &_existing_oid, 7, GIT_OBJECT_ANY)); cl_assert_equal_i(1, _fake->read_prefix_calls); @@ -126,7 +126,7 @@ void test_odb_backend_nonrefreshing__readheader_is_invoked_once_on_success(void) { git_odb *odb; size_t len; - git_otype type; + git_object_t type; cl_git_pass(git_repository_odb__weakptr(&odb, _repo)); diff --git a/tests/odb/emptyobjects.c b/tests/odb/emptyobjects.c index 61bb2b82c..89b22ad4a 100644 --- a/tests/odb/emptyobjects.c +++ b/tests/odb/emptyobjects.c @@ -27,7 +27,7 @@ void test_odb_emptyobjects__blob_notfound(void) cl_git_pass(git_oid_fromstr(&id, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391")); cl_git_fail_with(GIT_ENOTFOUND, git_blob_lookup(&blob, g_repo, &id)); - cl_git_pass(git_odb_write(&written_id, g_odb, "", 0, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&written_id, g_odb, "", 0, GIT_OBJECT_BLOB)); cl_assert(git_path_exists(TEST_REPO_PATH "/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391")); } @@ -38,7 +38,7 @@ void test_odb_emptyobjects__read_tree(void) cl_git_pass(git_oid_fromstr(&id, "4b825dc642cb6eb9a060e54bf8d69288fbee4904")); cl_git_pass(git_tree_lookup(&tree, g_repo, &id)); - cl_assert_equal_i(GIT_OBJ_TREE, git_object_type((git_object *) tree)); + cl_assert_equal_i(GIT_OBJECT_TREE, git_object_type((git_object *) tree)); cl_assert_equal_i(0, git_tree_entrycount(tree)); cl_assert_equal_p(NULL, git_tree_entry_byname(tree, "foo")); git_tree_free(tree); diff --git a/tests/odb/foreach.c b/tests/odb/foreach.c index 5db66ba27..3e44f10bb 100644 --- a/tests/odb/foreach.c +++ b/tests/odb/foreach.c @@ -98,7 +98,7 @@ void test_odb_foreach__interrupt_foreach(void) cl_git_pass(git_repository_init(&_repo, "onlyloose.git", true)); git_repository_odb(&_odb, _repo); - cl_git_pass(git_odb_write(&id, _odb, "", 0, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&id, _odb, "", 0, GIT_OBJECT_BLOB)); cl_assert_equal_i(-123, git_odb_foreach(_odb, foreach_stop_first_cb, &nobj)); } diff --git a/tests/odb/freshen.c b/tests/odb/freshen.c index 63541260e..1fe64309d 100644 --- a/tests/odb/freshen.c +++ b/tests/odb/freshen.c @@ -160,7 +160,7 @@ void test_odb_freshen__packed_object(void) /* ensure that packfile is freshened */ cl_git_pass(git_odb_write(&id, odb, PACKED_STR, - CONST_STRLEN(PACKED_STR), GIT_OBJ_BLOB)); + CONST_STRLEN(PACKED_STR), GIT_OBJECT_BLOB)); cl_assert_equal_oid(&expected_id, &id); cl_must_pass(p_lstat("testrepo.git/objects/pack/" PACKED_FN, &after)); @@ -171,7 +171,7 @@ void test_odb_freshen__packed_object(void) /* ensure that the pack file is not freshened again immediately */ cl_git_pass(git_odb_write(&id, odb, PACKED_STR, - CONST_STRLEN(PACKED_STR), GIT_OBJ_BLOB)); + CONST_STRLEN(PACKED_STR), GIT_OBJECT_BLOB)); cl_assert_equal_oid(&expected_id, &id); cl_must_pass(p_lstat("testrepo.git/objects/pack/" PACKED_FN, &after)); diff --git a/tests/odb/largefiles.c b/tests/odb/largefiles.c index 9fd99e520..8be2cfd02 100644 --- a/tests/odb/largefiles.c +++ b/tests/odb/largefiles.c @@ -29,7 +29,7 @@ static void writefile(git_oid *oid) for (i = 0; i < 3041; i++) cl_git_pass(git_buf_puts(&buf, "Hello, world.\n")); - cl_git_pass(git_odb_open_wstream(&stream, odb, LARGEFILE_SIZE, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_open_wstream(&stream, odb, LARGEFILE_SIZE, GIT_OBJECT_BLOB)); for (i = 0; i < 126103; i++) cl_git_pass(git_odb_stream_write(stream, buf.ptr, buf.size)); @@ -58,7 +58,7 @@ void test_odb_largefiles__write_from_memory(void) cl_git_pass(git_buf_puts(&buf, "Hello, world.\n")); git_oid_fromstr(&expected, "3fb56989cca483b21ba7cb0a6edb229d10e1c26c"); - cl_git_pass(git_odb_write(&oid, odb, buf.ptr, buf.size, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&oid, odb, buf.ptr, buf.size, GIT_OBJECT_BLOB)); cl_assert_equal_oid(&expected, &oid); } @@ -89,7 +89,7 @@ void test_odb_largefiles__streamread(void) char hdr[64]; size_t len, hdr_len, total = 0; git_hash_ctx hash; - git_otype type; + git_object_t type; int ret; #ifndef GIT_ARCH_64 @@ -105,7 +105,7 @@ void test_odb_largefiles__streamread(void) cl_git_pass(git_odb_open_rstream(&stream, &len, &type, odb, &oid)); cl_assert_equal_sz(LARGEFILE_SIZE, len); - cl_assert_equal_i(GIT_OBJ_BLOB, type); + cl_assert_equal_i(GIT_OBJECT_BLOB, type); cl_git_pass(git_hash_ctx_init(&hash)); cl_git_pass(git_odb__format_object_header(&hdr_len, hdr, sizeof(hdr), len, type)); @@ -171,7 +171,7 @@ void test_odb_largefiles__read_header(void) { git_oid oid; size_t len; - git_otype type; + git_object_t type; #ifndef GIT_ARCH_64 cl_skip(); @@ -185,5 +185,5 @@ void test_odb_largefiles__read_header(void) cl_git_pass(git_odb_read_header(&len, &type, odb, &oid)); cl_assert_equal_sz(LARGEFILE_SIZE, len); - cl_assert_equal_i(GIT_OBJ_BLOB, type); + cl_assert_equal_i(GIT_OBJECT_BLOB, type); } diff --git a/tests/odb/loose.c b/tests/odb/loose.c index 83d080729..5cf567cc2 100644 --- a/tests/odb/loose.c +++ b/tests/odb/loose.c @@ -60,7 +60,7 @@ static void test_read_header(object_data *data) git_oid id; git_odb *odb; size_t len; - git_otype type; + git_object_t type; write_object_files(data); @@ -212,7 +212,7 @@ void test_write_object_permission( cl_git_pass(git_odb_new(&odb)); cl_git_pass(git_odb_backend_loose(&backend, "test-objects", -1, 0, dir_mode, file_mode)); cl_git_pass(git_odb_add_backend(odb, backend, 1)); - cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJECT_BLOB)); cl_git_pass(p_stat("test-objects/67", &statbuf)); cl_assert_equal_i(statbuf.st_mode & os_mask, (expected_dir_mode & ~mask) & os_mask); @@ -247,7 +247,7 @@ static void write_object_to_loose_odb(int fsync) cl_git_pass(git_odb_new(&odb)); cl_git_pass(git_odb_backend_loose(&backend, "test-objects", -1, fsync, 0777, 0666)); cl_git_pass(git_odb_add_backend(odb, backend, 1)); - cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&oid, odb, "Test data\n", 10, GIT_OBJECT_BLOB)); git_odb_free(odb); } @@ -278,14 +278,14 @@ void test_odb_loose__fsync_obeys_repo_setting(void) cl_git_pass(git_repository_init(&repo, "test-objects", 1)); cl_git_pass(git_repository_odb__weakptr(&odb, repo)); - cl_git_pass(git_odb_write(&oid, odb, "No fsync here\n", 14, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&oid, odb, "No fsync here\n", 14, GIT_OBJECT_BLOB)); cl_assert(p_fsync__cnt == 0); git_repository_free(repo); cl_git_pass(git_repository_open(&repo, "test-objects")); cl_repo_set_bool(repo, "core.fsyncObjectFiles", true); cl_git_pass(git_repository_odb__weakptr(&odb, repo)); - cl_git_pass(git_odb_write(&oid, odb, "Now fsync\n", 10, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&oid, odb, "Now fsync\n", 10, GIT_OBJECT_BLOB)); cl_assert(p_fsync__cnt > 0); git_repository_free(repo); } diff --git a/tests/odb/mixed.c b/tests/odb/mixed.c index 515eadfde..ba2b2acb7 100644 --- a/tests/odb/mixed.c +++ b/tests/odb/mixed.c @@ -112,46 +112,46 @@ void test_odb_mixed__dup_oid_prefix_0(void) { struct expand_id_test_data { char *lookup_id; char *expected_id; - git_otype expected_type; + git_object_t expected_type; }; struct expand_id_test_data expand_id_test_data[] = { /* some prefixes and their expected values */ - { "dea509d0", NULL, GIT_OBJ_ANY }, - { "00000000", NULL, GIT_OBJ_ANY }, - { "dea509d0", NULL, GIT_OBJ_ANY }, - { "dea509d09", "dea509d097ce692e167dfc6a48a7a280cc5e877e", GIT_OBJ_BLOB }, - { "dea509d0b", "dea509d0b3cb8ee0650f6ca210bc83f4678851ba", GIT_OBJ_BLOB }, - { "ce0136250", "ce013625030ba8dba906f756967f9e9ca394464a", GIT_OBJ_BLOB }, - { "0ddeaded", NULL, GIT_OBJ_ANY }, - { "4d5979b", "4d5979b468252190cb572ae758aca36928e8a91e", GIT_OBJ_TREE }, - { "0ddeaded", NULL, GIT_OBJ_ANY }, - { "0ddeadede", "0ddeadede9e6d6ccddce0ee1e5749eed0485e5ea", GIT_OBJ_BLOB }, - { "0ddeaded9", "0ddeaded9502971eefe1e41e34d0e536853ae20f", GIT_OBJ_BLOB }, - { "f00b4e", NULL, GIT_OBJ_ANY }, + { "dea509d0", NULL, GIT_OBJECT_ANY }, + { "00000000", NULL, GIT_OBJECT_ANY }, + { "dea509d0", NULL, GIT_OBJECT_ANY }, + { "dea509d09", "dea509d097ce692e167dfc6a48a7a280cc5e877e", GIT_OBJECT_BLOB }, + { "dea509d0b", "dea509d0b3cb8ee0650f6ca210bc83f4678851ba", GIT_OBJECT_BLOB }, + { "ce0136250", "ce013625030ba8dba906f756967f9e9ca394464a", GIT_OBJECT_BLOB }, + { "0ddeaded", NULL, GIT_OBJECT_ANY }, + { "4d5979b", "4d5979b468252190cb572ae758aca36928e8a91e", GIT_OBJECT_TREE }, + { "0ddeaded", NULL, GIT_OBJECT_ANY }, + { "0ddeadede", "0ddeadede9e6d6ccddce0ee1e5749eed0485e5ea", GIT_OBJECT_BLOB }, + { "0ddeaded9", "0ddeaded9502971eefe1e41e34d0e536853ae20f", GIT_OBJECT_BLOB }, + { "f00b4e", NULL, GIT_OBJECT_ANY }, /* this OID is too short and should be ambiguous! */ - { "f00", NULL, GIT_OBJ_ANY }, + { "f00", NULL, GIT_OBJECT_ANY }, /* some full-length object ids */ - { "0000000000000000000000000000000000000000", NULL, GIT_OBJ_ANY }, + { "0000000000000000000000000000000000000000", NULL, GIT_OBJECT_ANY }, { "dea509d097ce692e167dfc6a48a7a280cc5e877e", "dea509d097ce692e167dfc6a48a7a280cc5e877e", - GIT_OBJ_BLOB + GIT_OBJECT_BLOB }, - { "f00f00f00f00f00f00f00f00f00f00f00f00f00f", NULL, GIT_OBJ_ANY }, + { "f00f00f00f00f00f00f00f00f00f00f00f00f00f", NULL, GIT_OBJECT_ANY }, { "4d5979b468252190cb572ae758aca36928e8a91e", "4d5979b468252190cb572ae758aca36928e8a91e", - GIT_OBJ_TREE + GIT_OBJECT_TREE }, /* * ensure we're not leaking the return error code for the * last lookup if the last object is invalid */ - { "0ddeadedfff", NULL, GIT_OBJ_ANY }, + { "0ddeadedfff", NULL, GIT_OBJECT_ANY }, }; static void setup_prefix_query( @@ -188,7 +188,7 @@ static void assert_found_objects(git_odb_expand_id *ids) for (i = 0; i < num; i++) { git_oid expected_id = {{0}}; size_t expected_len = 0; - git_otype expected_type = 0; + git_object_t expected_type = 0; if (expand_id_test_data[i].expected_id) { git_oid_fromstr(&expected_id, expand_id_test_data[i].expected_id); @@ -239,12 +239,12 @@ void test_odb_mixed__expand_ids(void) assert_found_objects(ids); git__free(ids); - /* test looking for an explicit GIT_OBJ_ANY */ + /* test looking for an explicit GIT_OBJECT_ANY */ setup_prefix_query(&ids, &num); for (i = 0; i < num; i++) - ids[i].type = GIT_OBJ_ANY; + ids[i].type = GIT_OBJECT_ANY; cl_git_pass(git_odb_expand_ids(_odb, ids, num)); assert_found_objects(ids); @@ -255,8 +255,8 @@ void test_odb_mixed__expand_ids(void) setup_prefix_query(&ids, &num); for (i = 0; i < num; i++) - ids[i].type = (ids[i].type == GIT_OBJ_BLOB) ? - GIT_OBJ_TREE : GIT_OBJ_BLOB; + ids[i].type = (ids[i].type == GIT_OBJECT_BLOB) ? + GIT_OBJECT_TREE : GIT_OBJECT_BLOB; cl_git_pass(git_odb_expand_ids(_odb, ids, num)); assert_notfound_objects(ids); diff --git a/tests/odb/packed.c b/tests/odb/packed.c index b4f549b58..3d502ed6d 100644 --- a/tests/odb/packed.c +++ b/tests/odb/packed.c @@ -39,7 +39,7 @@ void test_odb_packed__read_header_0(void) git_oid id; git_odb_object *obj; size_t len; - git_otype type; + git_object_t type; cl_git_pass(git_oid_fromstr(&id, packed_objects[i])); @@ -61,7 +61,7 @@ void test_odb_packed__read_header_1(void) git_oid id; git_odb_object *obj; size_t len; - git_otype type; + git_object_t type; cl_git_pass(git_oid_fromstr(&id, loose_objects[i])); diff --git a/tests/odb/packed_one.c b/tests/odb/packed_one.c index 0c6ed387b..17cd4f760 100644 --- a/tests/odb/packed_one.c +++ b/tests/odb/packed_one.c @@ -45,7 +45,7 @@ void test_odb_packed_one__read_header_0(void) git_oid id; git_odb_object *obj; size_t len; - git_otype type; + git_object_t type; cl_git_pass(git_oid_fromstr(&id, packed_objects_one[i])); diff --git a/tests/odb/streamwrite.c b/tests/odb/streamwrite.c index 591a20040..c174f6974 100644 --- a/tests/odb/streamwrite.c +++ b/tests/odb/streamwrite.c @@ -10,7 +10,7 @@ void test_odb_streamwrite__initialize(void) repo = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_repository_odb(&odb, repo)); - cl_git_pass(git_odb_open_wstream(&stream, odb, 14, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_open_wstream(&stream, odb, 14, GIT_OBJECT_BLOB)); cl_assert_equal_sz(14, stream->declared_size); } diff --git a/tests/pack/indexer.c b/tests/pack/indexer.c index 3a5021223..7b1daa984 100644 --- a/tests/pack/indexer.c +++ b/tests/pack/indexer.c @@ -156,7 +156,7 @@ void test_pack_indexer__fix_thin(void) cl_git_pass(git_repository_odb(&odb, repo)); /* Store the missing base into your ODB so the indexer can fix the pack */ - cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJECT_BLOB)); git_oid_fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18"); cl_assert_equal_oid(&should_id, &id); @@ -222,7 +222,7 @@ void test_pack_indexer__corrupt_length(void) cl_git_pass(git_repository_odb(&odb, repo)); /* Store the missing base into your ODB so the indexer can fix the pack */ - cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJECT_BLOB)); git_oid_fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18"); cl_assert_equal_oid(&should_id, &id); diff --git a/tests/pack/packbuilder.c b/tests/pack/packbuilder.c index bd2cebed2..6859001fe 100644 --- a/tests/pack/packbuilder.c +++ b/tests/pack/packbuilder.c @@ -76,7 +76,7 @@ static void seed_packbuilder(void) git_vector_foreach(&_commits, i, o) { git_object *obj; - cl_git_pass(git_object_lookup(&obj, _repo, o, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&obj, _repo, o, GIT_OBJECT_COMMIT)); cl_git_pass(git_packbuilder_insert_tree(_packbuilder, git_commit_tree_id((git_commit *)obj))); git_object_free(obj); diff --git a/tests/pack/sharing.c b/tests/pack/sharing.c index 81de9f81d..f6f78ca03 100644 --- a/tests/pack/sharing.c +++ b/tests/pack/sharing.c @@ -20,8 +20,8 @@ void test_pack_sharing__open_two_repos(void) git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); - cl_git_pass(git_object_lookup(&obj1, repo1, &id, GIT_OBJ_ANY)); - cl_git_pass(git_object_lookup(&obj2, repo2, &id, GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&obj1, repo1, &id, GIT_OBJECT_ANY)); + cl_git_pass(git_object_lookup(&obj2, repo2, &id, GIT_OBJECT_ANY)); pos = 0; while ((error = git_strmap_next(&data, &pos, git__pack_cache)) == 0) { diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c index 830593707..6a2bd38d2 100644 --- a/tests/rebase/merge.c +++ b/tests/rebase/merge.c @@ -647,7 +647,7 @@ static void test_copy_note( cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); cl_git_pass(git_reference_peel((git_object **)&branch_commit, - branch_ref, GIT_OBJ_COMMIT)); + branch_ref, GIT_OBJECT_COMMIT)); /* Add a note to a commit */ cl_git_pass(git_note_create(¬e_id, repo, "refs/notes/test", diff --git a/tests/rebase/setup.c b/tests/rebase/setup.c index f00294574..34d5edbf6 100644 --- a/tests/rebase/setup.c +++ b/tests/rebase/setup.c @@ -76,7 +76,7 @@ void test_rebase_setup__merge(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("b146bd7608eac53d9bf9e1a6963543588b555c64\n", 41, "rebase/.git/ORIG_HEAD"); @@ -122,7 +122,7 @@ void test_rebase_setup__merge_root(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("b146bd7608eac53d9bf9e1a6963543588b555c64\n", 41, "rebase/.git/ORIG_HEAD"); @@ -172,7 +172,7 @@ void test_rebase_setup__merge_onto_and_upstream(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("d616d97082eb7bb2dc6f180a7cca940993b7a56f\n", 41, "rebase/.git/ORIG_HEAD"); @@ -226,7 +226,7 @@ void test_rebase_setup__merge_onto_upstream_and_branch(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("f87d14a4a236582a0278a916340a793714256864\n", 41, "rebase/.git/ORIG_HEAD"); @@ -284,7 +284,7 @@ void test_rebase_setup__merge_onto_upstream_and_branch_by_id(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("d616d97082eb7bb2dc6f180a7cca940993b7a56f\n", 41, "rebase/.git/ORIG_HEAD"); @@ -330,7 +330,7 @@ void test_rebase_setup__branch_with_merges(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("f87d14a4a236582a0278a916340a793714256864\n", 41, "rebase/.git/ORIG_HEAD"); @@ -378,7 +378,7 @@ void test_rebase_setup__orphan_branch(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("12c084412b952396962eb420716df01022b847cc\n", 41, "rebase/.git/ORIG_HEAD"); @@ -429,7 +429,7 @@ void test_rebase_setup__merge_null_branch_uses_HEAD(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("b146bd7608eac53d9bf9e1a6963543588b555c64\n", 41, "rebase/.git/ORIG_HEAD"); @@ -476,7 +476,7 @@ void test_rebase_setup__merge_from_detached(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("b146bd7608eac53d9bf9e1a6963543588b555c64\n", 41, "rebase/.git/ORIG_HEAD"); @@ -524,7 +524,7 @@ void test_rebase_setup__merge_branch_by_id(void) git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00"); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); cl_assert_equal_oid(&head_id, git_commit_id(head_commit)); cl_assert_equal_file("b146bd7608eac53d9bf9e1a6963543588b555c64\n", 41, "rebase/.git/ORIG_HEAD"); @@ -554,15 +554,15 @@ static int rebase_is_blocked(void) git_reference *branch_ref, *upstream_ref; git_annotated_commit *branch_head, *upstream_head; - + cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo)); - + cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/beef")); cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master")); - + cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref)); - + error = git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL); git_annotated_commit_free(branch_head); diff --git a/tests/rebase/submodule.c b/tests/rebase/submodule.c index 5aa9ceb37..a28b3f4b2 100644 --- a/tests/rebase/submodule.c +++ b/tests/rebase/submodule.c @@ -44,7 +44,7 @@ void test_rebase_submodule__initialize(void) cl_git_pass(git_commit_create_v(&commit_id, repo, git_reference_name(master_ref), signature, signature, NULL, "Fixup .gitmodules", tree, 1, parent)); /* And a final reset, for good measure */ - cl_git_pass(git_object_lookup(&obj, repo, &commit_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&obj, repo, &commit_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, obj, GIT_RESET_HARD, &opts)); git_index_free(index); diff --git a/tests/refs/branches/upstream.c b/tests/refs/branches/upstream.c index 6024b1d7a..176f2a509 100644 --- a/tests/refs/branches/upstream.c +++ b/tests/refs/branches/upstream.c @@ -91,7 +91,7 @@ static void assert_merge_and_or_remote_key_missing(git_repository *repository, c { git_reference *branch; - cl_assert_equal_i(GIT_OBJ_COMMIT, git_object_type((git_object*)target)); + cl_assert_equal_i(GIT_OBJECT_COMMIT, git_object_type((git_object*)target)); cl_git_pass(git_branch_create(&branch, repository, entry_name, (git_commit*)target, 0)); cl_assert_equal_i(GIT_ENOTFOUND, git_branch_upstream(&upstream, branch)); @@ -108,7 +108,7 @@ void test_refs_branches_upstream__retrieve_a_remote_tracking_reference_from_a_br repository = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_repository_head(&head, repository)); - cl_git_pass(git_reference_peel(((git_object **)&target), head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(((git_object **)&target), head, GIT_OBJECT_COMMIT)); git_reference_free(head); assert_merge_and_or_remote_key_missing(repository, target, "remoteless"); diff --git a/tests/refs/peel.c b/tests/refs/peel.c index 09809e19e..38f3465a0 100644 --- a/tests/refs/peel.c +++ b/tests/refs/peel.c @@ -20,16 +20,16 @@ void test_refs_peel__cleanup(void) static void assert_peel_generic( git_repository *repo, const char *ref_name, - git_otype requested_type, + git_object_t requested_type, const char* expected_sha, - git_otype expected_type) + git_object_t expected_type) { git_oid expected_oid; git_reference *ref; git_object *peeled; cl_git_pass(git_reference_lookup(&ref, repo, ref_name)); - + cl_git_pass(git_reference_peel(&peeled, ref, requested_type)); cl_git_pass(git_oid_fromstr(&expected_oid, expected_sha)); @@ -43,21 +43,21 @@ static void assert_peel_generic( static void assert_peel( const char *ref_name, - git_otype requested_type, + git_object_t requested_type, const char* expected_sha, - git_otype expected_type) + git_object_t expected_type) { assert_peel_generic(g_repo, ref_name, requested_type, expected_sha, expected_type); } -static void assert_peel_error(int error, const char *ref_name, git_otype requested_type) +static void assert_peel_error(int error, const char *ref_name, git_object_t requested_type) { git_reference *ref; git_object *peeled; cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name)); - + cl_assert_equal_i(error, git_reference_peel(&peeled, ref, requested_type)); git_reference_free(ref); @@ -65,67 +65,67 @@ static void assert_peel_error(int error, const char *ref_name, git_otype request void test_refs_peel__can_peel_a_tag(void) { - assert_peel("refs/tags/test", GIT_OBJ_TAG, - "b25fa35b38051e4ae45d4222e795f9df2e43f1d1", GIT_OBJ_TAG); - assert_peel("refs/tags/test", GIT_OBJ_COMMIT, - "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT); - assert_peel("refs/tags/test", GIT_OBJ_TREE, - "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJ_TREE); - assert_peel("refs/tags/point_to_blob", GIT_OBJ_BLOB, - "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OBJ_BLOB); + assert_peel("refs/tags/test", GIT_OBJECT_TAG, + "b25fa35b38051e4ae45d4222e795f9df2e43f1d1", GIT_OBJECT_TAG); + assert_peel("refs/tags/test", GIT_OBJECT_COMMIT, + "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT); + assert_peel("refs/tags/test", GIT_OBJECT_TREE, + "53fc32d17276939fc79ed05badaef2db09990016", GIT_OBJECT_TREE); + assert_peel("refs/tags/point_to_blob", GIT_OBJECT_BLOB, + "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OBJECT_BLOB); } void test_refs_peel__can_peel_a_branch(void) { - assert_peel("refs/heads/master", GIT_OBJ_COMMIT, - "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJ_COMMIT); - assert_peel("refs/heads/master", GIT_OBJ_TREE, - "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OBJ_TREE); + assert_peel("refs/heads/master", GIT_OBJECT_COMMIT, + "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJECT_COMMIT); + assert_peel("refs/heads/master", GIT_OBJECT_TREE, + "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OBJECT_TREE); } void test_refs_peel__can_peel_a_symbolic_reference(void) { - assert_peel("HEAD", GIT_OBJ_COMMIT, - "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJ_COMMIT); - assert_peel("HEAD", GIT_OBJ_TREE, - "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OBJ_TREE); + assert_peel("HEAD", GIT_OBJECT_COMMIT, + "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJECT_COMMIT); + assert_peel("HEAD", GIT_OBJECT_TREE, + "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162", GIT_OBJECT_TREE); } void test_refs_peel__cannot_peel_into_a_non_existing_target(void) { - assert_peel_error(GIT_EINVALIDSPEC, "refs/tags/point_to_blob", GIT_OBJ_TAG); + assert_peel_error(GIT_EINVALIDSPEC, "refs/tags/point_to_blob", GIT_OBJECT_TAG); } void test_refs_peel__can_peel_into_any_non_tag_object(void) { - assert_peel("refs/heads/master", GIT_OBJ_ANY, - "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJ_COMMIT); - assert_peel("refs/tags/point_to_blob", GIT_OBJ_ANY, - "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OBJ_BLOB); - assert_peel("refs/tags/test", GIT_OBJ_ANY, - "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJ_COMMIT); + assert_peel("refs/heads/master", GIT_OBJECT_ANY, + "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OBJECT_COMMIT); + assert_peel("refs/tags/point_to_blob", GIT_OBJECT_ANY, + "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OBJECT_BLOB); + assert_peel("refs/tags/test", GIT_OBJECT_ANY, + "e90810b8df3e80c413d903f631643c716887138d", GIT_OBJECT_COMMIT); } void test_refs_peel__can_peel_fully_peeled_packed_refs(void) { assert_peel_generic(g_peel_repo, - "refs/tags/tag-inside-tags", GIT_OBJ_ANY, + "refs/tags/tag-inside-tags", GIT_OBJECT_ANY, "0df1a5865c8abfc09f1f2182e6a31be550e99f07", - GIT_OBJ_COMMIT); + GIT_OBJECT_COMMIT); assert_peel_generic(g_peel_repo, - "refs/foo/tag-outside-tags", GIT_OBJ_ANY, + "refs/foo/tag-outside-tags", GIT_OBJECT_ANY, "0df1a5865c8abfc09f1f2182e6a31be550e99f07", - GIT_OBJ_COMMIT); + GIT_OBJECT_COMMIT); } void test_refs_peel__can_peel_fully_peeled_tag_to_tag(void) { assert_peel_generic(g_peel_repo, - "refs/tags/tag-inside-tags", GIT_OBJ_TAG, + "refs/tags/tag-inside-tags", GIT_OBJECT_TAG, "c2596aa0151888587ec5c0187f261e63412d9e11", - GIT_OBJ_TAG); + GIT_OBJECT_TAG); assert_peel_generic(g_peel_repo, - "refs/foo/tag-outside-tags", GIT_OBJ_TAG, + "refs/foo/tag-outside-tags", GIT_OBJECT_TAG, "c2596aa0151888587ec5c0187f261e63412d9e11", - GIT_OBJ_TAG); + GIT_OBJECT_TAG); } diff --git a/tests/refs/read.c b/tests/refs/read.c index 3c7a0a1bf..5a1f554f0 100644 --- a/tests/refs/read.c +++ b/tests/refs/read.c @@ -38,9 +38,9 @@ void test_refs_read__loose_tag(void) cl_assert(reference_is_packed(reference) == 0); cl_assert_equal_s(reference->name, loose_tag_ref_name); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJECT_ANY)); cl_assert(object != NULL); - cl_assert(git_object_type(object) == GIT_OBJ_TAG); + cl_assert(git_object_type(object) == GIT_OBJECT_TAG); /* Ensure the name of the tag matches the name of the reference */ cl_git_pass(git_buf_joinpath(&ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object))); @@ -78,9 +78,9 @@ void test_refs_read__symbolic(void) cl_git_pass(git_reference_resolve(&resolved_ref, reference)); cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJECT_ANY)); cl_assert(object != NULL); - cl_assert(git_object_type(object) == GIT_OBJ_COMMIT); + cl_assert(git_object_type(object) == GIT_OBJECT_COMMIT); git_oid_fromstr(&id, current_master_tip); cl_assert_equal_oid(&id, git_object_id(object)); @@ -106,9 +106,9 @@ void test_refs_read__nested_symbolic(void) cl_git_pass(git_reference_resolve(&resolved_ref, reference)); cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(resolved_ref), GIT_OBJECT_ANY)); cl_assert(object != NULL); - cl_assert(git_object_type(object) == GIT_OBJ_COMMIT); + cl_assert(git_object_type(object) == GIT_OBJECT_COMMIT); git_oid_fromstr(&id, current_master_tip); cl_assert_equal_oid(&id, git_object_id(object)); @@ -171,9 +171,9 @@ void test_refs_read__packed(void) cl_assert(reference_is_packed(reference)); cl_assert_equal_s(reference->name, packed_head_name); - cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJ_ANY)); + cl_git_pass(git_object_lookup(&object, g_repo, git_reference_target(reference), GIT_OBJECT_ANY)); cl_assert(object != NULL); - cl_assert(git_object_type(object) == GIT_OBJ_COMMIT); + cl_assert(git_object_type(object) == GIT_OBJECT_COMMIT); git_object_free(object); diff --git a/tests/refs/reflog/messages.c b/tests/refs/reflog/messages.c index 3868e774d..5ca9ab31b 100644 --- a/tests/refs/reflog/messages.c +++ b/tests/refs/reflog/messages.c @@ -155,7 +155,7 @@ void test_refs_reflog_messages__branch_birth(void) cl_git_pass(git_signature_now(&sig, "me", "foo@example.com")); cl_git_pass(git_repository_head(&ref, g_repo)); - cl_git_pass(git_reference_peel((git_object **) &tree, ref, GIT_OBJ_TREE)); + cl_git_pass(git_reference_peel((git_object **) &tree, ref, GIT_OBJECT_TREE)); cl_git_pass(git_repository_set_head(g_repo, "refs/heads/orphan")); @@ -191,7 +191,7 @@ void test_refs_reflog_messages__commit_on_symbolic_ref_updates_head_reflog(void) cl_git_pass(git_signature_now(&sig, "me", "foo@example.com")); cl_git_pass(git_repository_head(&ref1, g_repo)); - cl_git_pass(git_reference_peel((git_object **) &tree, ref1, GIT_OBJ_TREE)); + cl_git_pass(git_reference_peel((git_object **) &tree, ref1, GIT_OBJECT_TREE)); nentries_master = reflog_entrycount(g_repo, "refs/heads/master"); diff --git a/tests/repo/env.c b/tests/repo/env.c index 8e2e5f85f..9dafda198 100644 --- a/tests/repo/env.c +++ b/tests/repo/env.c @@ -101,24 +101,24 @@ static void env_check_objects_(bool a, bool t, bool p, const char *file, int lin cl_git_expect(git_repository_open_ext(&repo, "attr", GIT_REPOSITORY_OPEN_FROM_ENV, NULL), 0, file, line); if (a) { - cl_git_expect(git_object_lookup(&object, repo, &oid_a, GIT_OBJ_BLOB), 0, file, line); + cl_git_expect(git_object_lookup(&object, repo, &oid_a, GIT_OBJECT_BLOB), 0, file, line); git_object_free(object); } else { - cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_a, GIT_OBJ_BLOB), file, line); + cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_a, GIT_OBJECT_BLOB), file, line); } if (t) { - cl_git_expect(git_object_lookup(&object, repo, &oid_t, GIT_OBJ_BLOB), 0, file, line); + cl_git_expect(git_object_lookup(&object, repo, &oid_t, GIT_OBJECT_BLOB), 0, file, line); git_object_free(object); } else { - cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_t, GIT_OBJ_BLOB), file, line); + cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_t, GIT_OBJECT_BLOB), file, line); } if (p) { - cl_git_expect(git_object_lookup(&object, repo, &oid_p, GIT_OBJ_COMMIT), 0, file, line); + cl_git_expect(git_object_lookup(&object, repo, &oid_p, GIT_OBJECT_COMMIT), 0, file, line); git_object_free(object); } else { - cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_p, GIT_OBJ_COMMIT), file, line); + cl_git_fail_at_line(git_object_lookup(&object, repo, &oid_p, GIT_OBJECT_COMMIT), file, line); } git_repository_free(repo); diff --git a/tests/repo/hashfile.c b/tests/repo/hashfile.c index 3c27aafbf..0fb4e6772 100644 --- a/tests/repo/hashfile.c +++ b/tests/repo/hashfile.c @@ -20,20 +20,20 @@ void test_repo_hashfile__simple(void) git_buf full = GIT_BUF_INIT; /* hash with repo relative path */ - cl_git_pass(git_odb_hashfile(&a, "status/current_file", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "current_file", GIT_OBJ_BLOB, NULL)); + cl_git_pass(git_odb_hashfile(&a, "status/current_file", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "current_file", GIT_OBJECT_BLOB, NULL)); cl_assert_equal_oid(&a, &b); cl_git_pass(git_buf_joinpath(&full, git_repository_workdir(_repo), "current_file")); /* hash with full path */ - cl_git_pass(git_odb_hashfile(&a, full.ptr, GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJ_BLOB, NULL)); + cl_git_pass(git_odb_hashfile(&a, full.ptr, GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJECT_BLOB, NULL)); cl_assert_equal_oid(&a, &b); /* hash with invalid type */ - cl_git_fail(git_odb_hashfile(&a, full.ptr, GIT_OBJ_ANY)); - cl_git_fail(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJ_OFS_DELTA, NULL)); + cl_git_fail(git_odb_hashfile(&a, full.ptr, GIT_OBJECT_ANY)); + cl_git_fail(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJECT_OFS_DELTA, NULL)); git_buf_dispose(&full); } @@ -51,35 +51,35 @@ void test_repo_hashfile__filtered(void) cl_git_mkfile("status/testfile.bin", "other\r\nstuff\r\n"); /* not equal hashes because of filtering */ - cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, NULL)); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_BLOB, NULL)); cl_assert(git_oid_cmp(&a, &b)); /* equal hashes because filter is binary */ - cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, NULL)); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJECT_BLOB, NULL)); cl_assert_equal_oid(&a, &b); /* equal hashes when 'as_file' points to binary filtering */ - cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, "foo.bin")); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_BLOB, "foo.bin")); cl_assert_equal_oid(&a, &b); /* not equal hashes when 'as_file' points to text filtering */ - cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, "foo.txt")); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJECT_BLOB, "foo.txt")); cl_assert(git_oid_cmp(&a, &b)); /* equal hashes when 'as_file' is empty and turns off filtering */ - cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, "")); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_BLOB, "")); cl_assert_equal_oid(&a, &b); - cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB)); - cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, "")); + cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJECT_BLOB)); + cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJECT_BLOB, "")); cl_assert_equal_oid(&a, &b); /* some hash type failures */ cl_git_fail(git_odb_hashfile(&a, "status/testfile.txt", 0)); - cl_git_fail(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_ANY, NULL)); + cl_git_fail(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJECT_ANY, NULL)); } diff --git a/tests/repo/head.c b/tests/repo/head.c index ed3b3dcc3..822990555 100644 --- a/tests/repo/head.c +++ b/tests/repo/head.c @@ -80,7 +80,7 @@ static void assert_head_is_correctly_detached(void) cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_object_lookup(&commit, repo, git_reference_target(head), GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&commit, repo, git_reference_target(head), GIT_OBJECT_COMMIT)); git_object_free(commit); git_reference_free(head); @@ -120,7 +120,7 @@ void test_repo_head__set_head_detached_Detaches_HEAD_and_make_it_point_to_the_pe git_object *tag; cl_git_pass(git_revparse_single(&tag, repo, "tags/test")); - cl_assert_equal_i(GIT_OBJ_TAG, git_object_type(tag)); + cl_assert_equal_i(GIT_OBJECT_TAG, git_object_type(tag)); cl_git_pass(git_repository_set_head_detached(repo, git_object_id(tag))); diff --git a/tests/reset/hard.c b/tests/reset/hard.c index d47ddd842..b6e91395b 100644 --- a/tests/reset/hard.c +++ b/tests/reset/hard.c @@ -248,7 +248,7 @@ void test_reset_hard__switch_file_to_dir(void) git_oid src_id, tgt_id; cl_git_pass(git_repository_odb(&odb, repo)); - cl_git_pass(git_odb_write(&entry.id, odb, "", 0, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_write(&entry.id, odb, "", 0, GIT_OBJECT_BLOB)); git_odb_free(odb); entry.mode = GIT_FILEMODE_BLOB; @@ -282,12 +282,12 @@ void test_reset_hard__switch_file_to_dir(void) git_signature_free(sig); /* Let's go to a known state of the src commit with the file named 'dir' */ - cl_git_pass(git_object_lookup(&commit, repo, &src_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&commit, repo, &src_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, commit, GIT_RESET_HARD, NULL)); git_object_free(commit); /* And now we move over to the commit with the directory named 'dir' */ - cl_git_pass(git_object_lookup(&commit, repo, &tgt_id, GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup(&commit, repo, &tgt_id, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, commit, GIT_RESET_HARD, NULL)); git_object_free(commit); } diff --git a/tests/reset/soft.c b/tests/reset/soft.c index 0ad47be2c..d9cfb0553 100644 --- a/tests/reset/soft.c +++ b/tests/reset/soft.c @@ -149,7 +149,7 @@ void test_reset_soft__fails_when_index_contains_conflicts_independently_of_MERGE git_index_free(index); cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel(&target, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&target, head, GIT_OBJECT_COMMIT)); git_reference_free(head); cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT, NULL)); diff --git a/tests/revert/bare.c b/tests/revert/bare.c index fda2b82b0..fc7d03065 100644 --- a/tests/revert/bare.c +++ b/tests/revert/bare.c @@ -68,7 +68,7 @@ void test_revert_bare__conflicts(void) git_oid_fromstr(&revert_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45"); cl_git_pass(git_repository_head(&head_ref, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head_ref, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head_ref, GIT_OBJECT_COMMIT)); cl_git_pass(git_commit_lookup(&revert_commit, repo, &revert_oid)); cl_git_pass(git_revert_commit(&index, repo, revert_commit, head_commit, 0, NULL)); diff --git a/tests/revert/workdir.c b/tests/revert/workdir.c index 53bb0e439..9acf20d6f 100644 --- a/tests/revert/workdir.c +++ b/tests/revert/workdir.c @@ -80,7 +80,7 @@ void test_revert_workdir__conflicts(void) git_oid_fromstr(&revert_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45"); cl_git_pass(git_repository_head(&head_ref, repo)); - cl_git_pass(git_reference_peel((git_object **)&head, head_ref, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head, head_ref, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL)); cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid)); @@ -178,7 +178,7 @@ void test_revert_workdir__again(void) }; cl_git_pass(git_repository_head(&head_ref, repo)); - cl_git_pass(git_reference_peel((git_object **)&orig_head, head_ref, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&orig_head, head_ref, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, (git_object *)orig_head, GIT_RESET_HARD, NULL)); cl_git_pass(git_revert(repo, orig_head, NULL)); @@ -477,7 +477,7 @@ void test_revert_workdir__head(void) /* HEAD is 2d440f2b3147d3dc7ad1085813478d6d869d5a4d */ cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD, NULL)); cl_git_pass(git_revert(repo, commit, NULL)); @@ -495,7 +495,7 @@ void test_revert_workdir__nonmerge_fails_mainline_specified(void) git_revert_options opts = GIT_REVERT_OPTIONS_INIT; cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJECT_COMMIT)); opts.mainline = 1; cl_must_fail(git_revert(repo, commit, &opts)); diff --git a/tests/revwalk/basic.c b/tests/revwalk/basic.c index efb48cbf1..2eb0c3537 100644 --- a/tests/revwalk/basic.c +++ b/tests/revwalk/basic.c @@ -292,9 +292,9 @@ void test_revwalk_basic__multiple_push_1(void) } /* -* Difference between test_revwalk_basic__multiple_push_1 and +* Difference between test_revwalk_basic__multiple_push_1 and * test_revwalk_basic__multiple_push_2 is in the order reference -* refs/heads/packed-test and commit 5b5b02 are pushed. +* refs/heads/packed-test and commit 5b5b02 are pushed. * revwalk should return same commits in both the tests. * $ git rev-list 5b5b02 HEAD ^refs/heads/packed-test @@ -509,7 +509,7 @@ void test_revwalk_basic__big_timestamp(void) revwalk_basic_setup_walk("testrepo.git"); cl_git_pass(git_repository_head(&head, _repo)); - cl_git_pass(git_reference_peel((git_object **) &tip, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **) &tip, head, GIT_OBJECT_COMMIT)); /* Commit with a far-ahead timestamp, we should be able to parse it in the revwalk */ cl_git_pass(git_signature_new(&sig, "Joe", "joe@example.com", 2399662595, 0)); diff --git a/tests/revwalk/mergebase.c b/tests/revwalk/mergebase.c index ee078b3e7..bee0b926e 100644 --- a/tests/revwalk/mergebase.c +++ b/tests/revwalk/mergebase.c @@ -198,12 +198,12 @@ static void assert_mergebase_many(const char *expected_sha, int count, ...) memset(oids, 0x0, count * sizeof(git_oid)); va_start(ap, count); - + for (i = 0; i < count; ++i) { partial_oid = va_arg(ap, char *); cl_git_pass(git_oid_fromstrn(&oid, partial_oid, strlen(partial_oid))); - cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJECT_COMMIT)); git_oid_cpy(&oids[i], git_object_id(object)); git_object_free(object); } @@ -267,7 +267,7 @@ static void assert_mergebase_octopus(const char *expected_sha, int count, ...) partial_oid = va_arg(ap, char *); cl_git_pass(git_oid_fromstrn(&oid, partial_oid, strlen(partial_oid))); - cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJ_COMMIT)); + cl_git_pass(git_object_lookup_prefix(&object, _repo, &oid, strlen(partial_oid), GIT_OBJECT_COMMIT)); git_oid_cpy(&oids[i], git_object_id(object)); git_object_free(object); } diff --git a/tests/stash/save.c b/tests/stash/save.c index eaa72a89e..c38ef8274 100644 --- a/tests/stash/save.c +++ b/tests/stash/save.c @@ -9,7 +9,7 @@ static git_oid stash_tip_oid; /* * Friendly reminder, in order to ease the reading of the following tests: * - * "stash" points to the worktree commit + * "stash" points to the worktree commit * "stash^1" points to the base commit (HEAD when the stash was created) * "stash^2" points to the index commit * "stash^3" points to the untracked commit @@ -35,7 +35,7 @@ void test_stash_save__cleanup(void) cl_fixture_cleanup("sorry-it-is-a-non-bare-only-party"); } -static void assert_object_oid(const char* revision, const char* expected_oid, git_otype type) +static void assert_object_oid(const char* revision, const char* expected_oid, git_object_t type) { int result; git_object *obj; @@ -55,7 +55,7 @@ static void assert_object_oid(const char* revision, const char* expected_oid, gi static void assert_blob_oid(const char* revision, const char* expected_oid) { - assert_object_oid(revision, expected_oid, GIT_OBJ_BLOB); + assert_object_oid(revision, expected_oid, GIT_OBJECT_BLOB); } void test_stash_save__does_not_keep_index_by_default(void) @@ -212,7 +212,7 @@ void test_stash_save__untracked_regression(void) cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel((git_object **)&head_commit, head, GIT_OBJECT_COMMIT)); opts.checkout_strategy = GIT_CHECKOUT_FORCE; @@ -275,12 +275,12 @@ void test_stash_save__can_stash_against_a_detached_head(void) void test_stash_save__stashing_updates_the_reflog(void) { - assert_object_oid("refs/stash@{0}", NULL, GIT_OBJ_COMMIT); + assert_object_oid("refs/stash@{0}", NULL, GIT_OBJECT_COMMIT); cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT)); - assert_object_oid("refs/stash@{0}", git_oid_tostr_s(&stash_tip_oid), GIT_OBJ_COMMIT); - assert_object_oid("refs/stash@{1}", NULL, GIT_OBJ_COMMIT); + assert_object_oid("refs/stash@{0}", git_oid_tostr_s(&stash_tip_oid), GIT_OBJECT_COMMIT); + assert_object_oid("refs/stash@{1}", NULL, GIT_OBJECT_COMMIT); } void test_stash_save__cannot_stash_when_there_are_no_local_change(void) @@ -386,7 +386,7 @@ void test_stash_save__can_stage_normal_then_stage_untracked(void) assert_blob_oid("stash@{1}^2:who", "cc628ccd10742baea8241c5924df992b5c019f71"); /* world */ assert_blob_oid("stash@{1}^2:when", NULL); - assert_object_oid("stash@{1}^3", NULL, GIT_OBJ_COMMIT); + assert_object_oid("stash@{1}^3", NULL, GIT_OBJECT_COMMIT); assert_blob_oid("stash@{0}^0:what", "ce013625030ba8dba906f756967f9e9ca394464a"); /* hello */ assert_blob_oid("stash@{0}^0:how", "ac790413e2d7a26c3767e78c57bb28716686eebc"); /* small */ @@ -415,7 +415,7 @@ void test_stash_save__including_untracked_without_any_untracked_file_creates_an_ cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_INCLUDE_UNTRACKED)); - assert_object_oid("stash^3^{tree}", EMPTY_TREE, GIT_OBJ_TREE); + assert_object_oid("stash^3^{tree}", EMPTY_TREE, GIT_OBJECT_TREE); } void test_stash_save__ignored_directory(void) diff --git a/tests/status/single.c b/tests/status/single.c index 6efaab294..e7f92097c 100644 --- a/tests/status/single.c +++ b/tests/status/single.c @@ -21,7 +21,7 @@ void test_status_single__hash_single_file(void) cl_git_mkfile(file_name, file_contents); cl_set_cleanup(&cleanup__remove_file, (void *)file_name); - cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJECT_BLOB)); cl_assert_equal_oid(&expected_id, &actual_id); } @@ -39,7 +39,7 @@ void test_status_single__hash_single_empty_file(void) cl_git_mkfile(file_name, file_contents); cl_set_cleanup(&cleanup__remove_file, (void *)file_name); - cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJ_BLOB)); + cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJECT_BLOB)); cl_assert_equal_oid(&expected_id, &actual_id); } diff --git a/tests/status/worktree.c b/tests/status/worktree.c index a83813ef4..4c37a337c 100644 --- a/tests/status/worktree.c +++ b/tests/status/worktree.c @@ -1163,7 +1163,7 @@ void test_status_worktree__update_index_with_symlink_doesnt_change_mode(void) opts.flags = GIT_STATUS_OPT_DEFAULTS | GIT_STATUS_OPT_UPDATE_INDEX; cl_git_pass(git_repository_head(&head, repo)); - cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL)); diff --git a/tests/submodule/init.c b/tests/submodule/init.c index b84adf508..84143e18f 100644 --- a/tests/submodule/init.c +++ b/tests/submodule/init.c @@ -87,7 +87,7 @@ void test_submodule_init__relative_url_detached_head(void) /* Put the parent repository into a detached head state. */ cl_git_pass(git_repository_head(&head_ref, g_repo)); - cl_git_pass(git_reference_peel(&head_commit, head_ref, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&head_commit, head_ref, GIT_OBJECT_COMMIT)); cl_git_pass(git_repository_set_head_detached(g_repo, git_commit_id((git_commit *)head_commit))); diff --git a/tests/submodule/update.c b/tests/submodule/update.c index cbd519d81..08a279a48 100644 --- a/tests/submodule/update.c +++ b/tests/submodule/update.c @@ -241,7 +241,7 @@ void test_submodule_update__update_already_checked_out_submodule(void) checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE; cl_git_pass(git_reference_lookup(&branch_reference, g_repo, "refs/heads/alternate_1")); - cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJECT_COMMIT)); cl_git_pass(git_checkout_tree(g_repo, branch_commit, &checkout_options)); cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference))); @@ -277,7 +277,7 @@ void test_submodule_update__update_already_checked_out_submodule(void) /* verify that the expected callbacks have been called. */ cl_assert_equal_i(1, update_payload.checkout_progress_called); - + git_submodule_free(sm); git_object_free(branch_commit); git_reference_free(branch_reference); @@ -319,7 +319,7 @@ void test_submodule_update__update_blocks_on_dirty_wd(void) checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE; cl_git_pass(git_reference_lookup(&branch_reference, g_repo, "refs/heads/alternate_1")); - cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJECT_COMMIT)); cl_git_pass(git_checkout_tree(g_repo, branch_commit, &checkout_options)); cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference))); @@ -396,7 +396,7 @@ void test_submodule_update__can_force_update(void) checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE; cl_git_pass(git_reference_lookup(&branch_reference, g_repo, "refs/heads/alternate_1")); - cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJ_COMMIT)); + cl_git_pass(git_reference_peel(&branch_commit, branch_reference, GIT_OBJECT_COMMIT)); cl_git_pass(git_checkout_tree(g_repo, branch_commit, &checkout_options)); cl_git_pass(git_repository_set_head(g_repo, git_reference_name(branch_reference))); -- cgit v1.2.1