Thread (1 message) 1 message, 1 author, 2025-01-03

Re: [PATCH 02/10] builtin/fast-import: fix segfault with unsafe SHA1

From: Junio C Hamano <hidden>
Date: 2025-01-03 16:25:28

Patrick Steinhardt [off-list ref] writes:
I think the ideal state would be if the hashing function used was stored
as part of `struct git_hash_ctx`. So the flow basically becomes for
example:
    struct git_hash_ctx ctx;
    struct object_id oid;

    git_hash_sha1_init(&ctx);
    git_hash_update(&ctx, data);
    git_hash_final_oid(&oid, &ctx);
Note how the intermediate calls don't need to know which hash function
you used to initialize the `struct git_hash_ctx` -- the structure itself
should remember what it has been initilized with and do the right thing.
Yup, that sounds perfect.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help