]> git.ipfire.org Git - thirdparty/git.git/commit
pack-write.c: prepare to write 'pack-*.rev' files
authorTaylor Blau <me@ttaylorr.com>
Mon, 25 Jan 2021 23:37:18 +0000 (18:37 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 Jan 2021 02:32:43 +0000 (18:32 -0800)
commit8ef50d9958f7be21e38026433d30f72521b4de47
treeb653d9be420dde954169b0af92ebf331ff607deb
parent2f4ba2a867f0390f139b622dbafcab766cb88e80
pack-write.c: prepare to write 'pack-*.rev' files

This patch prepares for callers to be able to write reverse index files
to disk.

It adds the necessary machinery to write a format-compliant .rev file
from within 'write_rev_file()', which is called from
'finish_tmp_packfile()'.

Similar to the process by which the reverse index is computed in memory,
these new paths also have to sort a list of objects by their offsets
within a packfile. These new paths use a qsort() (as opposed to a radix
sort), since our specialized radix sort requires a full revindex_entry
struct per object, which is more memory than we need to allocate.

The qsort is obviously slower, but the theoretical slowdown would
require a repository with a large amount of objects, likely implying
that the time spent in, say, pack-objects during a repack would dominate
the overall runtime.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-write.c
pack.h