mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
global: adapt callers to use generic hash context helpers
Adapt callers to use generic hash context helpers instead of using the hash algorithm to update them. This makes the callsites easier to reason about and removes the possibility that the wrong hash algorithm is used to update the hash context's state. And as a nice side effect this also gets rid of a bunch of users of `the_hash_algo`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b2755c15e2
commit
0578f1e66a
14
rerere.c
14
rerere.c
@@ -396,12 +396,12 @@ static int handle_conflict(struct strbuf *out, struct rerere_io *io,
|
||||
strbuf_addbuf(out, &two);
|
||||
rerere_strbuf_putconflict(out, '>', marker_size);
|
||||
if (ctx) {
|
||||
the_hash_algo->update_fn(ctx, one.buf ?
|
||||
one.buf : "",
|
||||
one.len + 1);
|
||||
the_hash_algo->update_fn(ctx, two.buf ?
|
||||
two.buf : "",
|
||||
two.len + 1);
|
||||
git_hash_update(ctx, one.buf ?
|
||||
one.buf : "",
|
||||
one.len + 1);
|
||||
git_hash_update(ctx, two.buf ?
|
||||
two.buf : "",
|
||||
two.len + 1);
|
||||
}
|
||||
break;
|
||||
} else if (hunk == RR_SIDE_1)
|
||||
@@ -453,7 +453,7 @@ static int handle_path(unsigned char *hash, struct rerere_io *io, int marker_siz
|
||||
strbuf_release(&out);
|
||||
|
||||
if (hash)
|
||||
the_hash_algo->final_fn(hash, &ctx);
|
||||
git_hash_final(hash, &ctx);
|
||||
|
||||
return has_conflicts;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user