#!/bin/sh global test_description := ''Test cloning a repository larger than 2 gigabyte'' source ./test-lib.sh if test -z $GIT_TEST_CLONE_2GB { say 'Skipping expensive 2GB clone test; enable it with GIT_TEST_CLONE_2GB=t' } else { test_set_prereq CLONE_2GB } test_expect_success CLONE_2GB 'setup' ' git config pack.compression 0 && git config pack.depth 0 && blobsize=$((100*1024*1024)) && blobcount=$((2*1024*1024*1024/$blobsize+1)) && i=1 && (while test $i -le $blobcount do printf "Generating blob $i/$blobcount\r" >&2 && printf "blob\nmark :$i\ndata $blobsize\n" && #test-genrandom $i $blobsize && printf "%-${blobsize}s" $i && echo "M 100644 :$i $i" >> commit i=$(($i+1)) || echo $? > exit-status done && echo "commit refs/heads/master" && echo "author A U Thor 123456789 +0000" && echo "committer C O Mitter 123456789 +0000" && echo "data 5" && echo ">2gb" && cat commit) | git fast-import --big-file-threshold=2 && test ! -f exit-status ' test_expect_success CLONE_2GB 'clone - bare' ' git clone --bare --no-hardlinks . clone-bare ' test_expect_success CLONE_2GB 'clone - with worktree, file:// protocol' ' git clone "file://$(pwd)" clone-wt ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"Test cloning a repository larger than 2 gigabyte">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$GIT_TEST_CLONE_2GB"))})] action: [ (C {(say)} {(SQ <"Skipping expensive 2GB clone test; enable it with GIT_TEST_CLONE_2GB=t">)}) ] spids: [-1 24] ) ] else_action: [(C {(test_set_prereq)} {(CLONE_2GB)})] spids: [33 40] ) (C {(test_expect_success)} {(CLONE_2GB)} {(SQ )} { (SQ <"\n"> <"\n"> <"\tgit config pack.compression 0 &&\n"> <"\tgit config pack.depth 0 &&\n"> <"\tblobsize=$((100*1024*1024)) &&\n"> <"\tblobcount=$((2*1024*1024*1024/$blobsize+1)) &&\n"> <"\ti=1 &&\n"> <"\t(while test $i -le $blobcount\n"> <"\t do\n"> <"\t\tprintf \"Generating blob $i/$blobcount\\r\" >&2 &&\n"> <"\t\tprintf \"blob\\nmark :$i\\ndata $blobsize\\n\" &&\n"> <"\t\t#test-genrandom $i $blobsize &&\n"> <"\t\tprintf \"%-${blobsize}s\" $i &&\n"> <"\t\techo \"M 100644 :$i $i\" >> commit\n"> <"\t\ti=$(($i+1)) ||\n"> <"\t\techo $? > exit-status\n"> <"\t done &&\n"> <"\t echo \"commit refs/heads/master\" &&\n"> <"\t echo \"author A U Thor 123456789 +0000\" &&\n"> <"\t echo \"committer C O Mitter 123456789 +0000\" &&\n"> <"\t echo \"data 5\" &&\n"> <"\t echo \">2gb\" &&\n"> <"\t cat commit) |\n"> <"\tgit fast-import --big-file-threshold=2 &&\n"> <"\ttest ! -f exit-status\n"> <"\n"> ) } ) (C {(test_expect_success)} {(CLONE_2GB)} {(SQ <"clone - bare">)} {(SQ <"\n"> <"\n"> <"\tgit clone --bare --no-hardlinks . clone-bare\n"> <"\n">)} ) (C {(test_expect_success)} {(CLONE_2GB)} {(SQ <"clone - with worktree, file:// protocol">)} {(SQ <"\n"> <"\n"> <"\tgit clone \"file://$(pwd)\" clone-wt\n"> <"\n">)} ) (C {(test_done)}) ] )