diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2018-11-28 14:26:57 +0000 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2018-12-01 11:54:57 +0000 |
commit | 168fe39bea3368972a8b1a33d5908e73bc790c18 (patch) | |
tree | c6d07340e2d8d2d66091c44c7763f3e1823acca2 /tests/odb | |
parent | 18e71e6d597abe6c7feb666429c921bd19dc0ba8 (diff) | |
download | libgit2-168fe39bea3368972a8b1a33d5908e73bc790c18.tar.gz |
object_type: use new enumeration namesethomson/index_fixes
Use the new object_type enumeration names within the codebase.
Diffstat (limited to 'tests/odb')
-rw-r--r-- | tests/odb/backend/backend_helpers.c | 12 | ||||
-rw-r--r-- | tests/odb/backend/mempack.c | 4 | ||||
-rw-r--r-- | tests/odb/backend/nobackend.c | 2 | ||||
-rw-r--r-- | tests/odb/backend/nonrefreshing.c | 12 | ||||
-rw-r--r-- | tests/odb/emptyobjects.c | 4 | ||||
-rw-r--r-- | tests/odb/foreach.c | 2 | ||||
-rw-r--r-- | tests/odb/freshen.c | 4 | ||||
-rw-r--r-- | tests/odb/largefiles.c | 12 | ||||
-rw-r--r-- | tests/odb/loose.c | 10 | ||||
-rw-r--r-- | tests/odb/mixed.c | 48 | ||||
-rw-r--r-- | tests/odb/packed.c | 4 | ||||
-rw-r--r-- | tests/odb/packed_one.c | 2 | ||||
-rw-r--r-- | tests/odb/streamwrite.c | 2 |
13 files changed, 59 insertions, 59 deletions
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); } |