summaryrefslogtreecommitdiff
path: root/Documentation/technical/rerere.txt
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2021-06-22 12:06:41 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-06-28 20:30:18 -0700
commit7463064b28086c0a765e247bc8336f8e32356494 (patch)
tree1d55d80344db95b9876e80537022563166ffb8a1 /Documentation/technical/rerere.txt
parentobject.h: expand docstring for lookup_unknown_object() (diff)
downloadtgif-7463064b28086c0a765e247bc8336f8e32356494.tar.xz
object.h: add lookup_object_by_type() function
In some cases it's useful for efficiency reasons to get the type of an object before deciding whether to parse it, but we still want an object struct. E.g., in reachable.c, bitmaps give us the type, but we just want to mark flags on each object. Likewise, we may loop over every object and only parse tags in order to peel them; checking the type first lets us avoid parsing the non-tags. But our lookup_blob(), etc, functions make getting an object struct annoying: we have to call the right function for every type. And we cannot just use the generic lookup_object(), because it only returns an already-seen object; it won't allocate a new object struct. Let's provide a function that dispatches to the correct lookup_* function based on a run-time type. In fact, reachable.c already has such a helper, so we'll just make that public. I did change the return type from "void *" to "struct object *". While the former is a clever way to avoid casting inside the function, it's less safe and less informative to people reading the function declaration. The next commit will add a new caller. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/technical/rerere.txt')
0 files changed, 0 insertions, 0 deletions