diff options
Diffstat (limited to 'tests/object')
-rw-r--r-- | tests/object/blob/fromstream.c | 4 | ||||
-rw-r--r-- | tests/object/cache.c | 52 | ||||
-rw-r--r-- | tests/object/commit/parse.c | 4 | ||||
-rw-r--r-- | tests/object/lookup.c | 18 | ||||
-rw-r--r-- | tests/object/lookupbypath.c | 14 | ||||
-rw-r--r-- | tests/object/peel.c | 92 | ||||
-rw-r--r-- | tests/object/raw/data.h | 16 | ||||
-rw-r--r-- | tests/object/raw/hash.c | 13 | ||||
-rw-r--r-- | tests/object/raw/type2string.c | 58 | ||||
-rw-r--r-- | tests/object/raw/write.c | 16 | ||||
-rw-r--r-- | tests/object/shortid.c | 8 | ||||
-rw-r--r-- | tests/object/tag/parse.c | 6 | ||||
-rw-r--r-- | tests/object/tag/peel.c | 10 | ||||
-rw-r--r-- | tests/object/tag/read.c | 6 | ||||
-rw-r--r-- | tests/object/tag/write.c | 14 | ||||
-rw-r--r-- | tests/object/tree/parse.c | 4 | ||||
-rw-r--r-- | tests/object/tree/read.c | 4 | ||||
-rw-r--r-- | tests/object/tree/walk.c | 2 |
18 files changed, 172 insertions, 169 deletions
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++; |