summaryrefslogtreecommitdiff
path: root/t/helper/test-hash.c
diff options
context:
space:
mode:
Diffstat (limited to 't/helper/test-hash.c')
-rw-r--r--t/helper/test-hash.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/t/helper/test-hash.c b/t/helper/test-hash.c
index 45d829c908..f0ee61c8b4 100644
--- a/t/helper/test-hash.c
+++ b/t/helper/test-hash.c
@@ -1,14 +1,16 @@
#include "test-tool.h"
#include "hex.h"
-int cmd_hash_impl(int ac, const char **av, int algo)
+int cmd_hash_impl(int ac, const char **av, int algo, int unsafe)
{
- git_hash_ctx ctx;
+ struct git_hash_ctx ctx;
unsigned char hash[GIT_MAX_HEXSZ];
unsigned bufsz = 8192;
int binary = 0;
char *buffer;
const struct git_hash_algo *algop = &hash_algos[algo];
+ if (unsafe)
+ algop = unsafe_hash_algo(algop);
if (ac == 2) {
if (!strcmp(av[1], "-b"))
@@ -46,9 +48,9 @@ int cmd_hash_impl(int ac, const char **av, int algo)
}
if (this_sz == 0)
break;
- algop->update_fn(&ctx, buffer, this_sz);
+ git_hash_update(&ctx, buffer, this_sz);
}
- algop->final_fn(hash, &ctx);
+ git_hash_final(hash, &ctx);
if (binary)
fwrite(hash, 1, algop->rawsz, stdout);