aboutsummaryrefslogtreecommitdiffstats
path: root/t/helper/test-hash.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-01-31 10:05:46 -0800
committerJunio C Hamano <gitster@pobox.com>2025-01-31 10:05:46 -0800
commit0cbcba54550b1ea108e977c24b835e07b96b1c0e (patch)
tree6cb525c7fdb38ee631d741c2f32bcaf2fffa5f07 /t/helper/test-hash.c
parentThe fifth batch (diff)
parenthash.h: drop unsafe_ function variants (diff)
downloadgit-0cbcba54550b1ea108e977c24b835e07b96b1c0e.tar.gz
git-0cbcba54550b1ea108e977c24b835e07b96b1c0e.zip
Merge branch 'tb/unsafe-hash-cleanup' into ps/hash-cleanup
* tb/unsafe-hash-cleanup: hash.h: drop unsafe_ function variants csum-file: introduce hashfile_checkpoint_init() t/helper/test-hash.c: use unsafe_hash_algo() csum-file.c: use unsafe_hash_algo() hash.h: introduce `unsafe_hash_algo()` csum-file.c: extract algop from hashfile_checksum_valid() csum-file: store the hash algorithm as a struct field t/helper/test-tool: implement sha1-unsafe helper
Diffstat (limited to 't/helper/test-hash.c')
-rw-r--r--t/helper/test-hash.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/t/helper/test-hash.c b/t/helper/test-hash.c
index 45d829c908..aa82638c62 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];
@@ -9,6 +9,8 @@ int cmd_hash_impl(int ac, const char **av, int algo)
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"))