Merge branch 'so/log-diff-merge'
[git] / t / t5608-clone-2gb.sh
1 #!/bin/sh
2
3 test_description='Test cloning a repository larger than 2 gigabyte'
4 . ./test-lib.sh
5
6 if ! test_bool_env GIT_TEST_CLONE_2GB false
7 then
8         skip_all='expensive 2GB clone test; enable with GIT_TEST_CLONE_2GB=true'
9         test_done
10 fi
11
12 test_expect_success 'setup' '
13
14         git config pack.compression 0 &&
15         git config pack.depth 0 &&
16         blobsize=$((100*1024*1024)) &&
17         blobcount=$((2*1024*1024*1024/$blobsize+1)) &&
18         i=1 &&
19         (while test $i -le $blobcount
20          do
21                 printf "Generating blob $i/$blobcount\r" >&2 &&
22                 printf "blob\nmark :$i\ndata $blobsize\n" &&
23                 #test-tool genrandom $i $blobsize &&
24                 printf "%-${blobsize}s" $i &&
25                 echo "M 100644 :$i $i" >> commit &&
26                 i=$(($i+1)) ||
27                 echo $? > exit-status
28          done &&
29          echo "commit refs/heads/main" &&
30          echo "author A U Thor <author@email.com> 123456789 +0000" &&
31          echo "committer C O Mitter <committer@email.com> 123456789 +0000" &&
32          echo "data 5" &&
33          echo ">2gb" &&
34          cat commit) |
35         git fast-import --big-file-threshold=2 &&
36         test ! -f exit-status
37
38 '
39
40 test_expect_success 'clone - bare' '
41
42         git clone --bare --no-hardlinks . clone-bare
43
44 '
45
46 test_expect_success 'clone - with worktree, file:// protocol' '
47
48         git clone "file://$(pwd)" clone-wt
49
50 '
51
52 test_done