t5303: use printf to generate delta bases
commit18f60f2d3dba291e1ea8e2751c1fce70580de8a9
authorJeff King <peff@peff.net>
Thu, 30 Aug 2018 19:13:39 +0000 (30 15:13 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Aug 2018 20:15:13 +0000 (30 13:15 -0700)
treef35ca151b8869eb345507b54aee97b7c616f98cf
parent9514b0b22624b9a6de80a480ab480d61ce29833b
t5303: use printf to generate delta bases

The exact byte count of the delta base file is important.
The test-delta helper will feed it to patch_delta(), which
will barf if it doesn't match the size byte given in the
delta. Using "echo" may end up with unexpected line endings
on some platforms (e.g,. "\r\n" instead of just "\n").

This actually wouldn't cause the test to fail (since we
already expect test-delta to complain about these bogus
deltas), but would mean that we're not exercising the code
we think we are.

Let's use printf instead (which we already trust to give us
byte-perfect output when we generate the deltas).

While we're here, let's tighten the 5-byte result size used
in the "truncated copy parameters" test. This just needs to
have enough room to attempt to parse the bogus copy command,
meaning 2 is sufficient. Using 5 was arbitrary and just
copied from the base size; since those no longer match, it's
simply confusing. Let's use a more meaningful number.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5303-pack-corruption-resilience.sh