summaryrefslogtreecommitdiff
path: root/t/t4013/diff.diff_initial..side
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2026-07-07 23:52:57 -0400
committerJunio C Hamano <gitster@pobox.com>2026-07-07 21:56:00 -0700
commit2c51615d3f57e116c60e825b4a0d587a6f0da12a (patch)
tree47f35519388faf1cff4d8c23bb75bc42885ceead /t/t4013/diff.diff_initial..side
parent90a55e3a51525370798d9b484a74a51ad2b3f047 (diff)
hash: make git_hash_discard() idempotent
You must always either finalize or discard a hash context to release any resources, but you must call only one such function. This creates extra work for some callers, since their cleanup code paths need to know whether they got there via their happy path (and the finalization happened) or due to an error (in which case they need to discard). Let's add an "active" flag that turns a redundant discard into a noop. That lets you safely do this: git_hash_init(&ctx, algo); ... if (some_error) goto out; ... git_hash_final(result, &ctx); out: git_hash_discard(&ctx); This should avoid future errors, and will also let us simplify a few existing callers (in future patches). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_initial..side')
0 files changed, 0 insertions, 0 deletions