From: Patrick Steinhardt Date: Fri, 03 Jul 2026 11:27:30 GMT Subject: Re: [PATCH 4/9] csum-file: provide a function to release checkpoints Message-ID: In-Reply-To: <20260702080319.GD2029434@coredump.intra.peff.net> On Thu, Jul 02, 2026 at 04:03:19AM -0400, Jeff King wrote: > A hashfile_checkpoint struct is basically just a copy of the hash_ctx > state at a given point in the file. As such, it contains its own > git_hash_ctx which may (depending on the underlying hash implementation) > need to be discarded when we're done with it. > > Let's add a "release" function which cleans up the hash context it > holds. I chose "release" here and not "discard" because you'd use this > to clean up every checkpoint, whether you used it or not. As opposed to > git_hash_discard(), which is needed only if you didn't call > git_hash_final(). Okay, I was wondering about that a bit. With this explanation I'm also somewhat fine with the `git_hash_discard()` name. It's still a function that has release semantics, but you want to convey more intent than that. One thing I was wondering: is it safe to have a `git_hash_discard()` that is being called on a potentially-already-discarded hash? If so, we wouldn't have to discern whether the hash context was used successfully or not. Patrick