diff options
author | Jeff King <peff@peff.net> | 2024-11-18 04:55:15 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-11-18 21:48:48 +0900 |
commit | 9202ffcf1064f883aacc4aba8016918e1d8d8243 (patch) | |
tree | 509ce689b0862f50cf149a64482a8a39d3e7a458 /commit-graph.c | |
parent | b2a95dfd63e812dc4abe5750371f2f0596d2d063 (diff) |
object-file: drop oid field from find_cached_object() return value
The pretend_object_file() function adds to an array mapping oids to
object contents, which are later retrieved with find_cached_object().
We naturally need to store the oid for each entry, since it's the lookup
key.
But find_cached_object() also returns a hard-coded empty_tree object.
There we don't care about its oid field and instead compare against
the_hash_algo->empty_tree. The oid field is left as all-zeroes.
This all works, but it means that the cached_object struct we return
from find_cached_object() may or may not have a valid oid field, depend
whether it is the hard-coded tree or came from pretend_object_file().
Nobody looks at the field, so there's no bug. But let's future-proof it
by returning only the object contents themselves, not the oid. We'll
continue to call this "struct cached_object", and the array entry
mapping the key to those contents will be a "cached_object_entry".
This would also let us swap out the array for a better data structure
(like a hashmap) if we chose, but there's not much point. The only code
that adds an entry is git-blame, which adds at most a single entry per
process.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
0 files changed, 0 insertions, 0 deletions