aboutsummaryrefslogtreecommitdiffstats
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.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/t/helper/test-hash.c b/t/helper/test-hash.c
index 45d829c908..d0ee668df9 100644
--- a/t/helper/test-hash.c
+++ b/t/helper/test-hash.c
@@ -1,7 +1,7 @@
#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;
unsigned char hash[GIT_MAX_HEXSZ];
@@ -27,7 +27,10 @@ int cmd_hash_impl(int ac, const char **av, int algo)
die("OOPS");
}
- algop->init_fn(&ctx);
+ if (unsafe)
+ algop->unsafe_init_fn(&ctx);
+ else
+ algop->init_fn(&ctx);
while (1) {
ssize_t sz, this_sz;
@@ -46,9 +49,15 @@ int cmd_hash_impl(int ac, const char **av, int algo)
}
if (this_sz == 0)
break;
- algop->update_fn(&ctx, buffer, this_sz);
+ if (unsafe)
+ algop->unsafe_update_fn(&ctx, buffer, this_sz);
+ else
+ algop->update_fn(&ctx, buffer, this_sz);
}
- algop->final_fn(hash, &ctx);
+ if (unsafe)
+ algop->unsafe_final_fn(hash, &ctx);
+ else
+ algop->final_fn(hash, &ctx);
if (binary)
fwrite(hash, 1, algop->rawsz, stdout);