summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-09-29 21:31:17 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-10-01 08:12:07 -0400
commit2a713da1ec2e9f74c9edc75b06540ab095c68c34 (patch)
tree488891e9b76cf54582738c48674e7dfde81cc638 /tests
parent3fff59705fec852b97639364ca7b3e84ff7040b7 (diff)
downloadlibgit2-2a713da1ec2e9f74c9edc75b06540ab095c68c34.tar.gz
hash: accept the algorithm in inputs
Diffstat (limited to 'tests')
-rw-r--r--tests/core/sha1.c2
-rw-r--r--tests/object/raw/hash.c6
-rw-r--r--tests/object/raw/short.c2
-rw-r--r--tests/odb/largefiles.c2
-rw-r--r--tests/pack/packbuilder.c2
5 files changed, 7 insertions, 7 deletions
diff --git a/tests/core/sha1.c b/tests/core/sha1.c
index 196b00352..aa351935b 100644
--- a/tests/core/sha1.c
+++ b/tests/core/sha1.c
@@ -23,7 +23,7 @@ static int sha1_file(git_oid *oid, const char *filename)
fd = p_open(filename, O_RDONLY);
cl_assert(fd >= 0);
- cl_git_pass(git_hash_ctx_init(&ctx));
+ cl_git_pass(git_hash_ctx_init(&ctx, GIT_HASH_ALGORITHM_SHA1));
while ((read_len = p_read(fd, buf, 2048)) > 0)
cl_git_pass(git_hash_update(&ctx, buf, (size_t)read_len));
diff --git a/tests/object/raw/hash.c b/tests/object/raw/hash.c
index 830f1caa1..e9a647627 100644
--- a/tests/object/raw/hash.c
+++ b/tests/object/raw/hash.c
@@ -26,7 +26,7 @@ void test_object_raw_hash__hash_by_blocks(void)
git_hash_ctx ctx;
git_oid id1, id2;
- cl_git_pass(git_hash_ctx_init(&ctx));
+ 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)));
@@ -49,7 +49,7 @@ void test_object_raw_hash__hash_buffer_in_single_call(void)
git_oid id1, id2;
cl_git_pass(git_oid_fromstr(&id1, hello_id));
- git_hash_buf(&id2, hello_text, strlen(hello_text));
+ git_hash_buf(&id2, hello_text, strlen(hello_text), GIT_HASH_ALGORITHM_SHA1);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
@@ -65,7 +65,7 @@ void test_object_raw_hash__hash_vector(void)
vec[1].data = hello_text+4;
vec[1].len = strlen(hello_text)-4;
- git_hash_vec(&id2, vec, 2);
+ git_hash_vec(&id2, vec, 2, GIT_HASH_ALGORITHM_SHA1);
cl_assert(git_oid_cmp(&id1, &id2) == 0);
}
diff --git a/tests/object/raw/short.c b/tests/object/raw/short.c
index 813cd86b6..626c9654b 100644
--- a/tests/object/raw/short.c
+++ b/tests/object/raw/short.c
@@ -33,7 +33,7 @@ static int insert_sequential_oids(
for (i = 0; i < n; ++i) {
p_snprintf(numbuf, sizeof(numbuf), "%u", (unsigned int)i);
- git_hash_buf(&oid, numbuf, strlen(numbuf));
+ git_hash_buf(&oid, numbuf, strlen(numbuf), GIT_HASH_ALGORITHM_SHA1);
oids[i] = git__malloc(GIT_OID_HEXSZ + 1);
cl_assert(oids[i]);
diff --git a/tests/odb/largefiles.c b/tests/odb/largefiles.c
index 8be2cfd02..03b183cd5 100644
--- a/tests/odb/largefiles.c
+++ b/tests/odb/largefiles.c
@@ -107,7 +107,7 @@ void test_odb_largefiles__streamread(void)
cl_assert_equal_sz(LARGEFILE_SIZE, len);
cl_assert_equal_i(GIT_OBJECT_BLOB, type);
- cl_git_pass(git_hash_ctx_init(&hash));
+ cl_git_pass(git_hash_ctx_init(&hash, GIT_HASH_ALGORITHM_SHA1));
cl_git_pass(git_odb__format_object_header(&hdr_len, hdr, sizeof(hdr), len, type));
cl_git_pass(git_hash_update(&hash, hdr, hdr_len));
diff --git a/tests/pack/packbuilder.c b/tests/pack/packbuilder.c
index 5f5441a5d..42d446a8b 100644
--- a/tests/pack/packbuilder.c
+++ b/tests/pack/packbuilder.c
@@ -126,7 +126,7 @@ void test_pack_packbuilder__create_pack(void)
cl_git_pass(git_futils_readbuffer(&buf, git_buf_cstr(&path)));
- cl_git_pass(git_hash_ctx_init(&ctx));
+ cl_git_pass(git_hash_ctx_init(&ctx, GIT_HASH_ALGORITHM_SHA1));
cl_git_pass(git_hash_update(&ctx, buf.ptr, buf.size));
cl_git_pass(git_hash_final(&hash, &ctx));
git_hash_ctx_cleanup(&ctx);