summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2012-10-04 04:02:53 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-10-04 20:34:28 -0700
commit6c4a060d7d895c90610eb442cb4f910fe43ef13a (patch)
tree8d7a9e6e23919cc3d5eeb477145298d352cd6583 /Documentation
parentpeel_ref: do not return a null sha1 (diff)
downloadtgif-6c4a060d7d895c90610eb442cb4f910fe43ef13a.tar.xz
peel_ref: check object type before loading
The point of peel_ref is to dereference tags; if the base object is not a tag, then we can return early without even loading the object into memory. This patch accomplishes that by checking sha1_object_info for the type. For a packed object, we can get away with just looking in the pack index. For a loose object, we only need to inflate the first couple of header bytes. This is a bit of a gamble; if we do find a tag object, then we will end up loading the content anyway, and the extra lookup will have been wasteful. However, if it is not a tag object, then we save loading the object entirely. Depending on the ratio of non-tags to tags in the input, this can be a minor win or minor loss. However, it does give us one potential major win: if a ref points to a large blob (e.g., via an unannotated tag), then we can avoid looking at it entirely. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
0 files changed, 0 insertions, 0 deletions