Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t1051-large-conversion.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t1051-large-conversion.sh` 113 lines ยท 3014 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='test conversion filters on large files' 4 5 . ./test-lib.sh 6 7 set_attr() { 8 test_when_finished 'rm -f .gitattributes' && 9 echo "* $*" >.gitattributes 10 } 11 12 check_input() { 13 git read-tree --empty && 14 git add small large && 15 git cat-file blob :small >small.index && 16 git cat-file blob :large | head -n 1 >large.index && 17 test_cmp small.index large.index 18 } 19 20 check_output() { 21 rm -f small large && 22 git checkout small large && 23 head -n 1 large >large.head && 24 test_cmp small large.head 25 } 26 27 test_expect_success 'setup input tests' ' 28 printf "\$Id: foo\$\\r\\n" >small && 29 cat small small >large && 30 git config core.bigfilethreshold 20 && 31 git config filter.test.clean "sed s/.*/CLEAN/" 32 ' 33 34 test_expect_success 'autocrlf=true converts on input' ' 35 test_config core.autocrlf true && 36 check_input 37 ' 38 39 test_expect_success 'eol=crlf converts on input' ' 40 set_attr eol=crlf && 41 check_input 42 ' 43 44 test_expect_success 'ident converts on input' ' 45 set_attr ident && 46 check_input 47 ' 48 49 test_expect_success 'user-defined filters convert on input' ' 50 set_attr filter=test && 51 check_input 52 ' 53 54 test_expect_success 'setup output tests' ' 55 echo "\$Id\$" >small && 56 cat small small >large && 57 git add small large && 58 git config core.bigfilethreshold 7 && 59 git config filter.test.smudge "sed s/.*/SMUDGE/" 60 ' 61 62 test_expect_success 'autocrlf=true converts on output' ' 63 test_config core.autocrlf true && 64 check_output 65 ' 66 67 test_expect_success 'eol=crlf converts on output' ' 68 set_attr eol=crlf && 69 check_output 70 ' 71 72 test_expect_success 'user-defined filters convert on output' ' 73 set_attr filter=test && 74 check_output 75 ' 76 77 test_expect_success 'ident converts on output' ' 78 set_attr ident && 79 rm -f small large && 80 git checkout small large && 81 sed -n "s/Id: .*/Id: SHA/p" small.clean && 82 head -n 1 large >large.head && 83 sed -n "s/Id: .*/Id: SHA/p" large.clean && 84 test_cmp small.clean large.clean 85 ' 86 87 # This smudge filter prepends 5GB of zeros to the file it checks out. This 88 # ensures that smudging doesn't mangle large files on 64-bit Windows. 89 test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT \ 90 'files over 4GB convert on output' ' 91 test_commit test small "a small file" && 92 small_size=$(test_file_size small) && 93 test_config filter.makelarge.smudge \ 94 "test-tool genzeros $((5*1024*1024*1024)) && cat" && 95 echo "small filter=makelarge" >.gitattributes && 96 rm small && 97 git checkout -- small && 98 size=$(test_file_size small) && 99 test "$size" -eq $((5 * 1024 * 1024 * 1024 + $small_size)) 100 ' 101 102 # This clean filter writes down the size of input it receives. By checking against 103 # the actual size, we ensure that cleaning doesn't mangle large files on 64-bit Windows. 104 test_expect_success EXPENSIVE,SIZE_T_IS_64BIT,!LONG_IS_64BIT \ 105 'files over 4GB convert on input' ' 106 test-tool genzeros $((5*1024*1024*1024)) >big && 107 test_config filter.checklarge.clean "wc -c >big.size" && 108 echo "big filter=checklarge" >.gitattributes && 109 git add big && 110 test $(test_file_size big) -eq $(cat big.size) 111 ' 112 113 test_done