]> git.99rst.org Git - git.git/commit
hash: document function pointers and wrappers
authorJeff King <redacted>
Wed, 8 Jul 2026 03:52:55 +0000 (23:52 -0400)
committerJunio C Hamano <redacted>
Wed, 8 Jul 2026 04:56:00 +0000 (21:56 -0700)
commit90a55e3a51525370798d9b484a74a51ad2b3f047
tree0207233075ac7c394269fb2cc0da361979c3bc33
parentb87af5aa77c07f014e14c91ac5f942fdef132df9
hash: document function pointers and wrappers

We want people to use the git_hash_*() wrappers rather than the bare
function pointers in the git_hash_algo struct. Let's document them
rather than the bare pointers, and warn people away from the pointers.
Coccinelle will eventually force the use of the wrappers, but it's
helpful to lead readers in the right direction from the start.

While we're here we can document a few other bits of wisdom I've turned
up while working in this area:

  - You have to initialize the destination of a git_hash_clone(). This
    is something we may eventually change for efficiency, but we should
    definitely document the requirement for now.

  - You must eventually finalize or discard a hash, since some backends
    may allocate resources during initialization.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
hash.h
git clone https://git.99rst.org/PROJECT