diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2022-01-23 09:47:01 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-06-20 17:05:29 -0400 |
| commit | 3fbf580c91935ccdea25a135204419991f503b63 (patch) | |
| tree | 53ec861796641faf8895a1f19444c1939ac6be9a /tests/libgit2/revwalk | |
| parent | 61838295a055c8c7a4a7eb730538c6e08a38dd6a (diff) | |
| download | libgit2-3fbf580c91935ccdea25a135204419991f503b63.tar.gz | |
oid: give oids a type
`git_oid`s now have a type, and we require the oid type when creating
the object id from creation functions.
Diffstat (limited to 'tests/libgit2/revwalk')
| -rw-r--r-- | tests/libgit2/revwalk/basic.c | 28 | ||||
| -rw-r--r-- | tests/libgit2/revwalk/hidecb.c | 4 | ||||
| -rw-r--r-- | tests/libgit2/revwalk/mergebase.c | 66 | ||||
| -rw-r--r-- | tests/libgit2/revwalk/simplify.c | 4 |
4 files changed, 51 insertions, 51 deletions
diff --git a/tests/libgit2/revwalk/basic.c b/tests/libgit2/revwalk/basic.c index 358f57716..88447a97e 100644 --- a/tests/libgit2/revwalk/basic.c +++ b/tests/libgit2/revwalk/basic.c @@ -139,7 +139,7 @@ void test_revwalk_basic__sorting_modes(void) revwalk_basic_setup_walk(NULL); - git_oid_fromstr(&id, commit_head); + git_oid_fromstr(&id, commit_head, GIT_OID_SHA1); cl_git_pass(test_walk(_walk, &id, GIT_SORT_TIME, commit_sorting_time, 1)); cl_git_pass(test_walk(_walk, &id, GIT_SORT_TOPOLOGICAL, commit_sorting_topo, 2)); @@ -204,7 +204,7 @@ void test_revwalk_basic__sorted_after_reset(void) revwalk_basic_setup_walk(NULL); - git_oid_fromstr(&oid, commit_head); + git_oid_fromstr(&oid, commit_head, GIT_OID_SHA1); /* push, sort, and test the walk */ cl_git_pass(git_revwalk_push(_walk, &oid)); @@ -282,7 +282,7 @@ void test_revwalk_basic__multiple_push_1(void) cl_git_pass(git_revwalk_hide_ref(_walk, "refs/heads/packed-test")); - cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644")); + cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1)); cl_git_pass(git_revwalk_push(_walk, &oid)); while (git_revwalk_next(&oid, _walk) == 0) @@ -316,7 +316,7 @@ void test_revwalk_basic__multiple_push_2(void) revwalk_basic_setup_walk(NULL); - cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644")); + cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1)); cl_git_pass(git_revwalk_push(_walk, &oid)); cl_git_pass(git_revwalk_hide_ref(_walk, "refs/heads/packed-test")); @@ -335,7 +335,7 @@ void test_revwalk_basic__disallow_non_commit(void) revwalk_basic_setup_walk(NULL); - cl_git_pass(git_oid_fromstr(&oid, "521d87c1ec3aef9824daf6d96cc0ae3710766d91")); + cl_git_pass(git_oid_fromstr(&oid, "521d87c1ec3aef9824daf6d96cc0ae3710766d91", GIT_OID_SHA1)); cl_git_fail(git_revwalk_push(_walk, &oid)); } @@ -345,7 +345,7 @@ void test_revwalk_basic__hide_then_push(void) int i = 0; revwalk_basic_setup_walk(NULL); - cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644")); + cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1)); cl_git_pass(git_revwalk_hide(_walk, &oid)); cl_git_pass(git_revwalk_push(_walk, &oid)); @@ -359,7 +359,7 @@ void test_revwalk_basic__hide_then_push(void) void test_revwalk_basic__topo_crash(void) { git_oid oid; - git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644"); + git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1); revwalk_basic_setup_walk(NULL); git_revwalk_sorting(_walk, GIT_SORT_TOPOLOGICAL); @@ -378,8 +378,8 @@ void test_revwalk_basic__from_new_to_old(void) revwalk_basic_setup_walk(NULL); git_revwalk_sorting(_walk, GIT_SORT_TIME); - cl_git_pass(git_oid_fromstr(&to_oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644")); - cl_git_pass(git_oid_fromstr(&from_oid, "a4a7dce85cf63874e984719f4fdd239f5145052f")); + cl_git_pass(git_oid_fromstr(&to_oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&from_oid, "a4a7dce85cf63874e984719f4fdd239f5145052f", GIT_OID_SHA1)); cl_git_pass(git_revwalk_push(_walk, &to_oid)); cl_git_pass(git_revwalk_hide(_walk, &from_oid)); @@ -479,7 +479,7 @@ void test_revwalk_basic__mimic_git_rev_list(void) cl_git_pass(git_revwalk_push_ref(_walk, "refs/heads/br2")); cl_git_pass(git_revwalk_push_ref(_walk, "refs/heads/master")); - cl_git_pass(git_oid_fromstr(&oid, "e90810b8df3e80c413d903f631643c716887138d")); + cl_git_pass(git_oid_fromstr(&oid, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1)); cl_git_pass(git_revwalk_push(_walk, &oid)); cl_git_pass(git_revwalk_next(&oid, _walk)); @@ -563,10 +563,10 @@ void test_revwalk_basic__old_hidden_commit_one(void) revwalk_basic_setup_walk("testrepo.git"); - cl_git_pass(git_oid_fromstr(&new_id, "bd758010071961f28336333bc41e9c64c9a64866")); + cl_git_pass(git_oid_fromstr(&new_id, "bd758010071961f28336333bc41e9c64c9a64866", GIT_OID_SHA1)); cl_git_pass(git_revwalk_push(_walk, &new_id)); - cl_git_pass(git_oid_fromstr(&old_id, "8e73b769e97678d684b809b163bebdae2911720f")); + cl_git_pass(git_oid_fromstr(&old_id, "8e73b769e97678d684b809b163bebdae2911720f", GIT_OID_SHA1)); cl_git_pass(git_revwalk_hide(_walk, &old_id)); cl_git_pass(git_revwalk_next(&oid, _walk)); @@ -587,10 +587,10 @@ void test_revwalk_basic__old_hidden_commit_two(void) revwalk_basic_setup_walk("testrepo.git"); - cl_git_pass(git_oid_fromstr(&new_id, "bd758010071961f28336333bc41e9c64c9a64866")); + cl_git_pass(git_oid_fromstr(&new_id, "bd758010071961f28336333bc41e9c64c9a64866", GIT_OID_SHA1)); cl_git_pass(git_revwalk_push(_walk, &new_id)); - cl_git_pass(git_oid_fromstr(&old_id, "b91e763008b10db366442469339f90a2b8400d0a")); + cl_git_pass(git_oid_fromstr(&old_id, "b91e763008b10db366442469339f90a2b8400d0a", GIT_OID_SHA1)); cl_git_pass(git_revwalk_hide(_walk, &old_id)); cl_git_pass(git_revwalk_next(&oid, _walk)); diff --git a/tests/libgit2/revwalk/hidecb.c b/tests/libgit2/revwalk/hidecb.c index 54315bc77..50990479f 100644 --- a/tests/libgit2/revwalk/hidecb.c +++ b/tests/libgit2/revwalk/hidecb.c @@ -32,10 +32,10 @@ void test_revwalk_hidecb__initialize(void) int i; cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git"))); - cl_git_pass(git_oid_fromstr(&_head_id, commit_head)); + cl_git_pass(git_oid_fromstr(&_head_id, commit_head, GIT_OID_SHA1)); for (i = 0; i < commit_count; i++) - cl_git_pass(git_oid_fromstr(&commit_ids[i], commit_strs[i])); + cl_git_pass(git_oid_fromstr(&commit_ids[i], commit_strs[i], GIT_OID_SHA1)); } diff --git a/tests/libgit2/revwalk/mergebase.c b/tests/libgit2/revwalk/mergebase.c index 0378c869b..52e37b103 100644 --- a/tests/libgit2/revwalk/mergebase.c +++ b/tests/libgit2/revwalk/mergebase.c @@ -25,9 +25,9 @@ void test_revwalk_mergebase__single1(void) git_oid result, one, two, expected; size_t ahead, behind; - cl_git_pass(git_oid_fromstr(&one, "c47800c7266a2be04c571c04d5a6614691ea99bd ")); - cl_git_pass(git_oid_fromstr(&two, "9fd738e8f7967c078dceed8190330fc8648ee56a")); - cl_git_pass(git_oid_fromstr(&expected, "5b5b025afb0b4c913b4c338a42934a3863bf3644")); + cl_git_pass(git_oid_fromstr(&one, "c47800c7266a2be04c571c04d5a6614691ea99bd ", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&two, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&expected, "5b5b025afb0b4c913b4c338a42934a3863bf3644", GIT_OID_SHA1)); cl_git_pass(git_merge_base(&result, _repo, &one, &two)); cl_assert_equal_oid(&expected, &result); @@ -46,9 +46,9 @@ void test_revwalk_mergebase__single2(void) git_oid result, one, two, expected; size_t ahead, behind; - cl_git_pass(git_oid_fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af")); - cl_git_pass(git_oid_fromstr(&two, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750")); - cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd")); + cl_git_pass(git_oid_fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&two, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1)); cl_git_pass(git_merge_base(&result, _repo, &one, &two)); cl_assert_equal_oid(&expected, &result); @@ -67,9 +67,9 @@ void test_revwalk_mergebase__merged_branch(void) git_oid result, one, two, expected; size_t ahead, behind; - cl_git_pass(git_oid_fromstr(&one, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750")); - cl_git_pass(git_oid_fromstr(&two, "9fd738e8f7967c078dceed8190330fc8648ee56a")); - cl_git_pass(git_oid_fromstr(&expected, "9fd738e8f7967c078dceed8190330fc8648ee56a")); + cl_git_pass(git_oid_fromstr(&one, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&two, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&expected, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1)); cl_git_pass(git_merge_base(&result, _repo, &one, &two)); cl_assert_equal_oid(&expected, &result); @@ -91,8 +91,8 @@ void test_revwalk_mergebase__two_way_merge(void) git_oid one, two; size_t ahead, behind; - cl_git_pass(git_oid_fromstr(&one, "9b219343610c88a1187c996d0dc58330b55cee28")); - cl_git_pass(git_oid_fromstr(&two, "a953a018c5b10b20c86e69fef55ebc8ad4c5a417")); + cl_git_pass(git_oid_fromstr(&one, "9b219343610c88a1187c996d0dc58330b55cee28", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&two, "a953a018c5b10b20c86e69fef55ebc8ad4c5a417", GIT_OID_SHA1)); cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo2, &one, &two)); cl_assert_equal_sz(ahead, 8); @@ -110,8 +110,8 @@ void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void) size_t ahead, behind; int error; - cl_git_pass(git_oid_fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af")); - cl_git_pass(git_oid_fromstr(&two, "e90810b8df3e80c413d903f631643c716887138d")); + cl_git_pass(git_oid_fromstr(&one, "763d71aadf09a7951596c9746c024e7eece7c7af", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&two, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1)); error = git_merge_base(&result, _repo, &one, &two); cl_git_fail(error); @@ -127,9 +127,9 @@ void test_revwalk_mergebase__prefer_youngest_merge_base(void) { git_oid result, one, two, expected; - cl_git_pass(git_oid_fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f")); - cl_git_pass(git_oid_fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); - cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd")); + cl_git_pass(git_oid_fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1)); cl_git_pass(git_merge_base(&result, _repo, &one, &two)); cl_assert_equal_oid(&expected, &result); @@ -140,10 +140,10 @@ void test_revwalk_mergebase__multiple_merge_bases(void) git_oid one, two, expected1, expected2; git_oidarray result = {NULL, 0}; - cl_git_pass(git_oid_fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f")); - cl_git_pass(git_oid_fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); - cl_git_pass(git_oid_fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd")); - cl_git_pass(git_oid_fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a")); + cl_git_pass(git_oid_fromstr(&one, "a4a7dce85cf63874e984719f4fdd239f5145052f", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&two, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1)); cl_git_pass(git_merge_bases(&result, _repo, &one, &two)); cl_assert_equal_i(2, result.count); @@ -160,10 +160,10 @@ void test_revwalk_mergebase__multiple_merge_bases_many_commits(void) git_oid *input = git__malloc(sizeof(git_oid) * 2); - cl_git_pass(git_oid_fromstr(&input[0], "a4a7dce85cf63874e984719f4fdd239f5145052f")); - cl_git_pass(git_oid_fromstr(&input[1], "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); - cl_git_pass(git_oid_fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd")); - cl_git_pass(git_oid_fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a")); + cl_git_pass(git_oid_fromstr(&input[0], "a4a7dce85cf63874e984719f4fdd239f5145052f", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&input[1], "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&expected1, "c47800c7266a2be04c571c04d5a6614691ea99bd", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&expected2, "9fd738e8f7967c078dceed8190330fc8648ee56a", GIT_OID_SHA1)); cl_git_pass(git_merge_bases_many(&result, _repo, 2, input)); cl_assert_equal_i(2, result.count); @@ -178,8 +178,8 @@ void test_revwalk_mergebase__no_off_by_one_missing(void) { git_oid result, one, two; - cl_git_pass(git_oid_fromstr(&one, "1a443023183e3f2bfbef8ac923cd81c1018a18fd")); - cl_git_pass(git_oid_fromstr(&two, "9f13f7d0a9402c681f91dc590cf7b5470e6a77d2")); + cl_git_pass(git_oid_fromstr(&one, "1a443023183e3f2bfbef8ac923cd81c1018a18fd", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&two, "9f13f7d0a9402c681f91dc590cf7b5470e6a77d2", GIT_OID_SHA1)); cl_git_pass(git_merge_base(&result, _repo, &one, &two)); } @@ -201,7 +201,7 @@ static void assert_mergebase_many(const char *expected_sha, int 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_oid_fromstrn(&oid, partial_oid, strlen(partial_oid), GIT_OID_SHA1)); 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)); @@ -214,7 +214,7 @@ static void assert_mergebase_many(const char *expected_sha, int count, ...) cl_assert_equal_i(GIT_ENOTFOUND, git_merge_base_many(&oid, _repo, count, oids)); else { cl_git_pass(git_merge_base_many(&oid, _repo, count, oids)); - cl_git_pass(git_oid_fromstr(&expected, expected_sha)); + cl_git_pass(git_oid_fromstr(&expected, expected_sha, GIT_OID_SHA1)); cl_assert_equal_oid(&expected, &oid); } @@ -265,7 +265,7 @@ static void assert_mergebase_octopus(const char *expected_sha, int 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_oid_fromstrn(&oid, partial_oid, strlen(partial_oid), GIT_OID_SHA1)); 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)); @@ -278,7 +278,7 @@ static void assert_mergebase_octopus(const char *expected_sha, int count, ...) cl_assert_equal_i(GIT_ENOTFOUND, git_merge_base_octopus(&oid, _repo, count, oids)); else { cl_git_pass(git_merge_base_octopus(&oid, _repo, count, oids)); - cl_git_pass(git_oid_fromstr(&expected, expected_sha)); + cl_git_pass(git_oid_fromstr(&expected, expected_sha, GIT_OID_SHA1)); cl_assert_equal_oid(&expected, &oid); } @@ -501,9 +501,9 @@ void test_revwalk_mergebase__remove_redundant(void) cl_git_pass(git_repository_open(&repo, cl_fixture("redundant.git"))); - cl_git_pass(git_oid_fromstr(&one, "d89137c93ba1ee749214ff4ce52ae9137bc833f9")); - cl_git_pass(git_oid_fromstr(&two, "91f4b95df4a59504a9813ba66912562931d990e3")); - cl_git_pass(git_oid_fromstr(&base, "6cb1f2352d974e1c5a776093017e8772416ac97a")); + cl_git_pass(git_oid_fromstr(&one, "d89137c93ba1ee749214ff4ce52ae9137bc833f9", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&two, "91f4b95df4a59504a9813ba66912562931d990e3", GIT_OID_SHA1)); + cl_git_pass(git_oid_fromstr(&base, "6cb1f2352d974e1c5a776093017e8772416ac97a", GIT_OID_SHA1)); cl_git_pass(git_merge_bases(&result, repo, &one, &two)); cl_assert_equal_i(1, result.count); diff --git a/tests/libgit2/revwalk/simplify.c b/tests/libgit2/revwalk/simplify.c index 6dd068a42..fb7b900e0 100644 --- a/tests/libgit2/revwalk/simplify.c +++ b/tests/libgit2/revwalk/simplify.c @@ -32,13 +32,13 @@ void test_revwalk_simplify__first_parent(void) int i, error; for (i = 0; i < 4; i++) { - git_oid_fromstr(&expected[i], expected_str[i]); + git_oid_fromstr(&expected[i], expected_str[i], GIT_OID_SHA1); } repo = cl_git_sandbox_init("testrepo.git"); cl_git_pass(git_revwalk_new(&walk, repo)); - git_oid_fromstr(&id, commit_head); + git_oid_fromstr(&id, commit_head, GIT_OID_SHA1); cl_git_pass(git_revwalk_push(walk, &id)); git_revwalk_sorting(walk, GIT_SORT_TOPOLOGICAL); git_revwalk_simplify_first_parent(walk); |
