object: remove OFS_DELTA and REF_DELTA values

Deltas are not objects, they're entries in a packfile. Remove them from
the object enum.
This commit is contained in:
Edward Thomson
2025-01-03 09:43:32 +00:00
parent 2d5942571c
commit 23da3a8f3c
8 changed files with 36 additions and 34 deletions

View File

@@ -87,16 +87,16 @@ void test_object_raw_hash__hash_junk_data(void)
junk_obj.data = some_data;
hash_object_fail(&id, &junk_obj);
junk_obj.type = 0; /* EXT1 */
junk_obj.type = 0; /* unused */
hash_object_fail(&id, &junk_obj);
junk_obj.type = 5; /* EXT2 */
junk_obj.type = 5; /* unused */
hash_object_fail(&id, &junk_obj);
junk_obj.type = GIT_OBJECT_OFS_DELTA;
junk_obj.type = 6; /* packfile offset delta */
hash_object_fail(&id, &junk_obj);
junk_obj.type = GIT_OBJECT_REF_DELTA;
junk_obj.type = 7; /* packfile ref delta */
hash_object_fail(&id, &junk_obj);
junk_obj.type = 42;

View File

@@ -7,14 +7,14 @@
void test_object_raw_type2string__convert_type_to_string(void)
{
cl_assert_equal_s(git_object_type2string(GIT_OBJECT_INVALID), "");
cl_assert_equal_s(git_object_type2string(0), ""); /* EXT1 */
cl_assert_equal_s(git_object_type2string(0), ""); /* unused */
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(5), ""); /* unused */
cl_assert_equal_s(git_object_type2string(6), ""); /* packfile offset delta */
cl_assert_equal_s(git_object_type2string(7), ""); /* packfile ref delta */
cl_assert_equal_s(git_object_type2string(-2), "");
cl_assert_equal_s(git_object_type2string(8), "");
@@ -29,8 +29,8 @@ void test_object_raw_type2string__convert_string_to_type(void)
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("OFS_DELTA") == GIT_OBJECT_INVALID);
cl_assert(git_object_string2type("REF_DELTA") == GIT_OBJECT_INVALID);
cl_assert(git_object_string2type("CoMmIt") == GIT_OBJECT_INVALID);
cl_assert(git_object_string2type("hohoho") == GIT_OBJECT_INVALID);
@@ -39,14 +39,14 @@ void test_object_raw_type2string__convert_string_to_type(void)
void test_object_raw_type2string__check_type_is_valid(void)
{
cl_assert(git_object_type_is_valid(GIT_OBJECT_INVALID) == 0);
cl_assert(git_object_type_is_valid(0) == 0); /* EXT1 */
cl_assert(git_object_type_is_valid(0) == 0); /* unused */
cl_assert(git_object_type_is_valid(GIT_OBJECT_COMMIT) == 1);
cl_assert(git_object_type_is_valid(GIT_OBJECT_TREE) == 1);
cl_assert(git_object_type_is_valid(GIT_OBJECT_BLOB) == 1);
cl_assert(git_object_type_is_valid(GIT_OBJECT_TAG) == 1);
cl_assert(git_object_type_is_valid(5) == 0); /* EXT2 */
cl_assert(git_object_type_is_valid(GIT_OBJECT_OFS_DELTA) == 0);
cl_assert(git_object_type_is_valid(GIT_OBJECT_REF_DELTA) == 0);
cl_assert(git_object_type_is_valid(5) == 0); /* unused */
cl_assert(git_object_type_is_valid(6) == 0); /* packfile offset delta */
cl_assert(git_object_type_is_valid(7) == 0); /* packfile ref delta */
cl_assert(git_object_type_is_valid(-2) == 0);
cl_assert(git_object_type_is_valid(8) == 0);

View File

@@ -34,7 +34,7 @@ void test_repo_hashfile__simple(void)
/* hash with invalid type */
cl_git_fail(git_odb__hashfile(&a, full.ptr, GIT_OBJECT_ANY, GIT_OID_SHA1));
cl_git_fail(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJECT_OFS_DELTA, NULL));
cl_git_fail(git_repository_hashfile(&b, _repo, full.ptr, 6, NULL));
git_str_dispose(&full);
}