mirror of
https://github.com/git/git.git
synced 2026-08-09 01:21:47 +00:00
hash: use git_hash_init() consistently
We'd like to add more logic to git_hash_init(), but many callers skip it and call algop->init_fn() directly. Let's make sure we're consistently using the wrapper by adding a coccinelle rule. Besides the coccinelle file itself, this is a purely mechanical conversion based on the patch it generates. There should be no bare init_fn() calls left (except for the one in the wrapper). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
f08ece0e2c
commit
9b204b825b
@@ -670,10 +670,10 @@ int cmd_unpack_objects(int argc,
|
||||
/* We don't take any non-flag arguments now.. Maybe some day */
|
||||
usage(unpack_usage);
|
||||
}
|
||||
the_hash_algo->init_fn(&ctx);
|
||||
git_hash_init(&ctx, the_hash_algo);
|
||||
unpack_all();
|
||||
git_hash_update(&ctx, buffer, offset);
|
||||
the_hash_algo->init_fn(&tmp_ctx);
|
||||
git_hash_init(&tmp_ctx, the_hash_algo);
|
||||
git_hash_clone(&tmp_ctx, &ctx);
|
||||
git_hash_final_oid(&oid, &tmp_ctx);
|
||||
if (strict) {
|
||||
|
||||
Reference in New Issue
Block a user