]> Kevux Git Server - rit/commit
test-tool: add pack-deltas helper
authorDerrick Stolee <stolee@gmail.com>
Mon, 28 Apr 2025 20:24:43 +0000 (20:24 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Apr 2025 22:37:25 +0000 (15:37 -0700)
commit89d557b950c7a0581c12452e8f9576c45546246b
tree2fb783e101f46258e52468e6948a499698e55c1a
parent4bbb303af69990ccd05fe3a2eb58a1ce036f8220
test-tool: add pack-deltas helper

When trying to demonstrate certain behavior in tests, it can be helpful
to create packfiles that have specific delta structures. 'git
pack-objects' uses various algorithms to select deltas based on their
compression rates, but that does not always demonstrate all possible
packfile shapes. This becomes especially important when wanting to test
'git index-pack' and its ability to parse certain pack shapes.

We have prior art in t/lib-pack.sh, where certain delta structures are
produced by manually writing certain opaque pack contents. However,
producing these script updates is cumbersome and difficult to do as a
contributor.

Instead, create a new test-tool, 'test-tool pack-deltas', that reads a
list of instructions for which objects to include in a packfile and how
those objects should be written in delta form.

At the moment, this only supports REF_DELTAs as those are the kinds of
deltas needed to exercise a bug in 'git index-pack'.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
t/helper/meson.build
t/helper/test-pack-deltas.c [new file with mode: 0644]
t/helper/test-tool.c
t/helper/test-tool.h