summaryrefslogtreecommitdiff
path: root/contrib/subtree
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2013-12-21 09:24:20 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-12-26 11:53:32 -0800
commit5d642e75069334944fcc795a80cf04749dd12857 (patch)
treeaf2396187952817f081170e8b8deff9c051de041 /contrib/subtree
parentSync with 1.8.5.2 (diff)
downloadtgif-5d642e75069334944fcc795a80cf04749dd12857.tar.xz
sha1_object_info_extended: provide delta base sha1s
A caller of sha1_object_info_extended technically has enough information to determine the base sha1 from the results of the call. It knows the pack, offset, and delta type of the object, which is sufficient to find the base. However, the functions to do so are not publicly available, and the code itself is intimate enough with the pack details that it should be abstracted away. We could add a public helper to allow callers to query the delta base separately, but it is simpler and slightly more efficient to optionally grab it along with the rest of the object_info data. For cases where the object is not stored as a delta, we write the null sha1 into the query field. A careful caller could check "oi.whence == OI_PACKED && oi.u.packed.is_delta" before looking at the base sha1, but using the null sha1 provides a simple alternative (and gives a better sanity check for a non-careful caller than simply returning random bytes). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/subtree')
0 files changed, 0 insertions, 0 deletions