]> git.ipfire.org Git - thirdparty/git.git/commit
object-file: inline empty tree and blob literals
authorJeff King <peff@peff.net>
Mon, 18 Nov 2024 09:55:22 +0000 (04:55 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Nov 2024 12:48:48 +0000 (21:48 +0900)
commit2af8ead52be9b72f3db76c9016cc4444eea33544
treee2042cea048024b5c135538df6a9a506d1b3895b
parente37feea00b2b81c0295fddb4f5137d12ea1825c0
object-file: inline empty tree and blob literals

We define macros with the bytes of the empty trees and blobs for sha1
and sha256. But since e1ccd7e2b1 (sha1_file: only expose empty object
constants through git_hash_algo, 2018-05-02), those are used only for
initializing the git_hash_algo entries. Any other code using the macros
directly would be suspicious, since a hash_algo pointer is the level of
indirection we use to make everything work with both sha1 and sha256.

So let's future proof against code doing the wrong thing by dropping the
macros entirely and just initializing the structs directly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object-file.c