t5332-multi-pack-reuse.sh: extract pack-objects helper functions
commit7c01878eeb15e8dd75f0262bdfb3249c85a30a4a
authorTaylor Blau <me@ttaylorr.com>
Mon, 5 Feb 2024 22:50:19 +0000 (5 17:50 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 5 Feb 2024 23:27:00 +0000 (5 15:27 -0800)
tree750ee28e0d54c0b07fb8fba5f5ef506a8e653b14
parent2a540e432fe5dff3cfa9d3bf7ca56db2ad12ebb9
t5332-multi-pack-reuse.sh: extract pack-objects helper functions

Most of the tests in t5332 perform some setup before repeating a common
refrain that looks like:

    : >trace2.txt &&
    GIT_TRACE2_EVENT="$PWD/trace2.txt" \
      git pack-objects --stdout --revs --all >/dev/null &&

    test_pack_reused $objects_nr <trace2.txt &&
    test_packs_reused $packs_nr <trace2.txt

The next commit will add more tests which repeat the above refrain.
Avoid duplicating this invocation even further and prepare for the
following commit by wrapping the above in a helper function called
`test_pack_objects_reused_all()`.

Introduce another similar function `test_pack_objects_reused`, which
expects to read a list of revisions over stdin for tests which need more
fine-grained control of the contents of the pack they generate.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5332-multi-pack-reuse.sh