diff --git a/t/t5590-push-path-walk.sh b/t/t5590-push-path-walk.sh index 792c37cff1bb9b..df27b2056efd78 100755 --- a/t/t5590-push-path-walk.sh +++ b/t/t5590-push-path-walk.sh @@ -8,16 +8,20 @@ TEST_PASSES_SANITIZE_LEAK=true test_expect_success 'setup bare repository and clone' ' git init --bare -b main bare.git && + git --git-dir=bare.git config receive.unpackLimit 0 && git --git-dir bare.git commit-tree -m initial $EMPTY_TREE >head_oid && git --git-dir bare.git update-ref refs/heads/main $(cat head_oid) && git clone --bare bare.git clone.git ' test_expect_success 'avoid reusing deltified objects' ' + # construct two commits, one containing a file with the hex digits + # repeated 16 times, the next reducing that to 8 times. The crucial + # part is that the blob of the second commit is deltified _really_ + # badly and it is therefore easy to detect if a `git push` reused that + # delta. x="0123456789abcdef" && printf "$x$x$x$x$x$x$x$x" >x128 && printf "$x$x$x$x$x$x$x$x$x$x$x$x$x$x$x$x" >x256 && - oid128=$(git hash-object x128) && - oid256=$(git hash-object x256) && pack=clone.git/objects/pack/pack-tmp.pack && pack_header 2 >$pack && @@ -46,14 +50,51 @@ test_expect_success 'avoid reusing deltified objects' ' printf "\x80\x02" >>$pack && # object size = 0x80 (encoded as 0x80 | (0x80 & 0x7f), 0x80 >> 7 printf "\x80\x01" >>$pack && - # enourmously badly-deltified object: copy every single byte individually + # massively badly-deltified object: copy every single byte individually # 0x80 = copy, 0x01 = use 1 byte to encode the offset (0), 0x10 = use 1 byte to encode the size (1, i.e. 0x01) printf "$(printf "\\\\x91\\\\x%02x\\\\x01" $(test_seq 0 127))" >>$pack && # Manually-computed Adler32 checksum: 0x99c369c4 printf "\x99\xc3\x69\xc4" >>$pack && pack_trailer $pack && - git index-pack -v $pack + git index-pack -v $pack && + + oid256=$(git hash-object x256) && + printf "100755 blob $oid256\thex\n" >tree && + tree_oid="$(git --git-dir=clone.git mktree tree && + tree_oid="$(git --git-dir=clone.git mktree verify && + size="$(sed -n "s/^$oid128 blob *\([^ ]*\).*/\1/p" verify && + size="$(sed -n "s/^$oid128 blob *\([^ ]*\).*/\1/p"