From 0959b83301caad805b8447299ea3ed6238e4bb9a Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 1 Oct 2026 15:56:31 -1000 Subject: Send a clone file with its size in whole batches The dumb transport read a pack four kilobytes at a time through stdio and sent it without a length, so a client could not tell a cut-off transfer from a complete one. --- tests/t0303-robustness.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index cb16957..8d64c1e 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -479,6 +479,21 @@ test_expect_success 'the dumb transport serves an empty repository' ' grep "^Status: 404" tmp ' +# A pack is handed over as it sits on the disk, so the client can be told +# its size up front and compare what arrived against it. +test_expect_success 'the dumb transport sends a file with its size' ' + git -C repos/rob repack -q -d && + robq "url=rob/objects/info/packs" >tmp && + pack=$(strip_headers tmp && + grep "^Status: 200" tmp && + size=$(wc -c body && + cmp body repos/rob/.git/objects/pack/$pack +' + test_expect_success 'a symlink whose target is a large blob is listed without it' ' big=$(head -c 5000 /dev/zero | tr "\0" a | git -C repos/rob hash-object -w --stdin) && ( -- cgit v2.8.0