diff options
author | Taylor Blau <me@ttaylorr.com> | 2021-08-29 22:48:54 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-08-29 23:25:20 -0700 |
commit | a9fd2f207d0318cd7a4771f13c9fb4759d280f68 (patch) | |
tree | 953b67c08bf870f7e7594138bcf26be685e29d04 /Documentation/git-shell.txt | |
parent | object-store.h: teach for_each_packed_object to ignore kept packs (diff) | |
download | tgif-a9fd2f207d0318cd7a4771f13c9fb4759d280f68.tar.xz |
builtin/pack-objects.c: simplify add_objects_in_unpacked_packs()
This function is used to implement `pack-objects`'s `--keep-unreachable`
option, but can be simplified in a couple of ways:
- add_objects_in_unpacked_packs() iterates over all packs (and then
all packed objects) itself, but could use for_each_packed_object()
instead since the missing flags necessary were added in the previous
commit
- objects are added to an in_pack array which store (off_t, object)
tuples, and then sorted in offset order when we could iterate
objects in offset order.
There is a slight behavior change here: before we would have added
objects in sorted offset order among _all_ packs. Handing objects to
create_object_entry() in pack order for each pack (instead of
feeding objects from all packs simultaneously their offset relative
to different packs) is much more reasonable, if different than how
the code currently works.
- objects in a single pack are iterated in index order and searched
for in order to discover their offsets, which is much less efficient
than using the on-disk reverse index
Simplify the function by addressing each of the above and moving the
core of the loop into a callback function that we then pass to
for_each_packed_object() instead of open-coding the latter function
ourselves.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-shell.txt')
0 files changed, 0 insertions, 0 deletions