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