diff options
author | Jeff King <peff@peff.net> | 2020-02-23 23:29:44 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-24 12:55:52 -0800 |
commit | 3f83fd5e44c1f038c8a7033cb77399e9ef4f43a9 (patch) | |
tree | d640d83f4d693682b2252817d60a3c5e19d47c44 /Documentation/git-fast-export.txt | |
parent | nth_packed_object_oid(): use customary integer return (diff) | |
download | tgif-3f83fd5e44c1f038c8a7033cb77399e9ef4f43a9.tar.xz |
pack-objects: read delta base oid into object_id struct
When we're considering reusing an on-disk delta, we get the oid of the
base as a pointer to unsigned char bytes of the hash, either into the
packfile itself (for REF_DELTA) or into the pack idx (using the revindex
to convert the offset into an index entry).
Instead, we'd prefer to use a more type-safe object_id as much as
possible. We can get the pack idx using nth_packed_object_id() instead.
For the packfile bytes, we can copy them out using oidread().
This doesn't even incur an extra copy overall, since the next thing we'd
always do with that pointer is pass it to can_reuse_delta(), which needs
an object_id anyway (and called oidread() itself). So this patch also
converts that function to take the object_id directly.
Note that we did previously use NULL as a sentinel value when the object
isn't a delta. We could probably get away with using the null oid for
this, but instead we'll use an explicit boolean flag, which should make
things more obvious for people reading the code later.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-fast-export.txt')
0 files changed, 0 insertions, 0 deletions