diff options
| author | lhchavez <lhchavez@lhchavez.com> | 2022-06-11 14:31:16 -0700 |
|---|---|---|
| committer | lhchavez <lhchavez@lhchavez.com> | 2022-06-11 14:31:16 -0700 |
| commit | 0a7c00be7fb5e85574bbe4676465b24b22f40e87 (patch) | |
| tree | 2002cc48489ef3735a487899b6bf4170399d147a /tests/libgit2 | |
| parent | a75416761c28326262b8c48ebc81f34702fa33b1 (diff) | |
| parent | 2b28ee77ca5f03f90f616abb718168fcff6756aa (diff) | |
| download | libgit2-0a7c00be7fb5e85574bbe4676465b24b22f40e87.tar.gz | |
Merge remote-tracking branch 'origin/main' into main
Diffstat (limited to 'tests/libgit2')
| -rw-r--r-- | tests/libgit2/iterator/tree.c | 2 | ||||
| -rw-r--r-- | tests/libgit2/object/raw/hash.c | 11 | ||||
| -rw-r--r-- | tests/libgit2/object/raw/short.c | 5 | ||||
| -rw-r--r-- | tests/libgit2/object/tree/parse.c | 2 | ||||
| -rw-r--r-- | tests/libgit2/pack/packbuilder.c | 2 | ||||
| -rw-r--r-- | tests/libgit2/refs/revparse.c | 2 |
6 files changed, 15 insertions, 9 deletions
diff --git a/tests/libgit2/iterator/tree.c b/tests/libgit2/iterator/tree.c index 4145c8dea..06a920a18 100644 --- a/tests/libgit2/iterator/tree.c +++ b/tests/libgit2/iterator/tree.c @@ -268,7 +268,7 @@ static void check_tree_entry( cl_git_pass(git_iterator_current_tree_entry(&te, i)); cl_assert(te); - cl_assert(git_oid_streq(te->oid, oid) == 0); + cl_assert(git_oid_streq(&te->oid, oid) == 0); cl_git_pass(git_iterator_current(&ie, i)); diff --git a/tests/libgit2/object/raw/hash.c b/tests/libgit2/object/raw/hash.c index 5a3e81855..8f22fe0ee 100644 --- a/tests/libgit2/object/raw/hash.c +++ b/tests/libgit2/object/raw/hash.c @@ -24,20 +24,23 @@ static char *bye_text = "bye world\n"; void test_object_raw_hash__hash_by_blocks(void) { git_hash_ctx ctx; + unsigned char hash[GIT_HASH_SHA1_SIZE]; git_oid id1, id2; cl_git_pass(git_hash_ctx_init(&ctx, GIT_HASH_ALGORITHM_SHA1)); /* should already be init'd */ cl_git_pass(git_hash_update(&ctx, hello_text, strlen(hello_text))); - cl_git_pass(git_hash_final(id2.id, &ctx)); + cl_git_pass(git_hash_final(hash, &ctx)); + cl_git_pass(git_oid_fromraw(&id2, hash)); cl_git_pass(git_oid_fromstr(&id1, hello_id)); cl_assert(git_oid_cmp(&id1, &id2) == 0); /* reinit should permit reuse */ cl_git_pass(git_hash_init(&ctx)); cl_git_pass(git_hash_update(&ctx, bye_text, strlen(bye_text))); - cl_git_pass(git_hash_final(id2.id, &ctx)); + cl_git_pass(git_hash_final(hash, &ctx)); + cl_git_pass(git_oid_fromraw(&id2, hash)); cl_git_pass(git_oid_fromstr(&id1, bye_id)); cl_assert(git_oid_cmp(&id1, &id2) == 0); @@ -47,9 +50,11 @@ void test_object_raw_hash__hash_by_blocks(void) void test_object_raw_hash__hash_buffer_in_single_call(void) { git_oid id1, id2; + unsigned char hash[GIT_HASH_SHA1_SIZE]; cl_git_pass(git_oid_fromstr(&id1, hello_id)); - git_hash_buf(id2.id, hello_text, strlen(hello_text), GIT_HASH_ALGORITHM_SHA1); + cl_git_pass(git_hash_buf(hash, hello_text, strlen(hello_text), GIT_HASH_ALGORITHM_SHA1)); + cl_git_pass(git_oid_fromraw(&id2, hash)); cl_assert(git_oid_cmp(&id1, &id2) == 0); } diff --git a/tests/libgit2/object/raw/short.c b/tests/libgit2/object/raw/short.c index e8d2cf5a5..cc2b5f62a 100644 --- a/tests/libgit2/object/raw/short.c +++ b/tests/libgit2/object/raw/short.c @@ -28,12 +28,15 @@ static int insert_sequential_oids( int i, min_len = 0; char numbuf[16]; git_oid oid; + unsigned char hashbuf[GIT_HASH_SHA1_SIZE]; char **oids = git__calloc(n, sizeof(char *)); cl_assert(oids != NULL); for (i = 0; i < n; ++i) { p_snprintf(numbuf, sizeof(numbuf), "%u", (unsigned int)i); - git_hash_buf(oid.id, numbuf, strlen(numbuf), GIT_HASH_ALGORITHM_SHA1); + git_hash_buf(hashbuf, numbuf, strlen(numbuf), GIT_HASH_ALGORITHM_SHA1); + + git_oid_fromraw(&oid, hashbuf); oids[i] = git__malloc(GIT_OID_HEXSZ + 1); cl_assert(oids[i]); diff --git a/tests/libgit2/object/tree/parse.c b/tests/libgit2/object/tree/parse.c index 9d76a74f0..4e871dcfa 100644 --- a/tests/libgit2/object/tree/parse.c +++ b/tests/libgit2/object/tree/parse.c @@ -40,7 +40,7 @@ static void assert_tree_parses(const char *data, size_t datalen, cl_assert(entry = git_tree_entry_byname(tree, expected->filename)); cl_assert_equal_s(expected->filename, entry->filename); cl_assert_equal_i(expected->attr, entry->attr); - cl_assert_equal_oid(&oid, entry->oid); + cl_assert_equal_oid(&oid, &entry->oid); } git_object_free(&tree->object); diff --git a/tests/libgit2/pack/packbuilder.c b/tests/libgit2/pack/packbuilder.c index f23579817..0889f46ed 100644 --- a/tests/libgit2/pack/packbuilder.c +++ b/tests/libgit2/pack/packbuilder.c @@ -68,7 +68,7 @@ static void seed_packbuilder(void) cl_git_pass(git_revwalk_push_ref(_revwalker, "HEAD")); while (git_revwalk_next(&oid, _revwalker) == 0) { - o = git__malloc(GIT_OID_RAWSZ); + o = git__malloc(sizeof(git_oid)); cl_assert(o != NULL); git_oid_cpy(o, &oid); cl_git_pass(git_vector_insert(&_commits, o)); diff --git a/tests/libgit2/refs/revparse.c b/tests/libgit2/refs/revparse.c index 0bd2ae5bc..56af3c939 100644 --- a/tests/libgit2/refs/revparse.c +++ b/tests/libgit2/refs/revparse.c @@ -399,8 +399,6 @@ void test_refs_revparse__date(void) * a65fedf HEAD@{1335806603 -0900}: commit: * be3563a HEAD@{1335806563 -0700}: clone: from /Users/ben/src/libgit2/tests/resour */ - test_object("HEAD@{10 years ago}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"); - test_object("HEAD@{1 second}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); test_object("HEAD@{1 second ago}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); test_object("HEAD@{2 days ago}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); |
