Merge branch 'wk/user-manual'
[git/raj.git] / t / t1051-large-conversion.sh
blob8b7640b3ba8a80c7f5034d71f2484c394970a1af
1 #!/bin/sh
3 test_description='test conversion filters on large files'
4 . ./test-lib.sh
6 set_attr() {
7 test_when_finished 'rm -f .gitattributes' &&
8 echo "* $*" >.gitattributes
11 check_input() {
12 git read-tree --empty &&
13 git add small large &&
14 git cat-file blob :small >small.index &&
15 git cat-file blob :large | head -n 1 >large.index &&
16 test_cmp small.index large.index
19 check_output() {
20 rm -f small large &&
21 git checkout small large &&
22 head -n 1 large >large.head &&
23 test_cmp small large.head
26 test_expect_success 'setup input tests' '
27 printf "\$Id: foo\$\\r\\n" >small &&
28 cat small small >large &&
29 git config core.bigfilethreshold 20 &&
30 git config filter.test.clean "sed s/.*/CLEAN/"
33 test_expect_success 'autocrlf=true converts on input' '
34 test_config core.autocrlf true &&
35 check_input
38 test_expect_success 'eol=crlf converts on input' '
39 set_attr eol=crlf &&
40 check_input
43 test_expect_success 'ident converts on input' '
44 set_attr ident &&
45 check_input
48 test_expect_success 'user-defined filters convert on input' '
49 set_attr filter=test &&
50 check_input
53 test_expect_success 'setup output tests' '
54 echo "\$Id\$" >small &&
55 cat small small >large &&
56 git add small large &&
57 git config core.bigfilethreshold 7 &&
58 git config filter.test.smudge "sed s/.*/SMUDGE/"
61 test_expect_success 'autocrlf=true converts on output' '
62 test_config core.autocrlf true &&
63 check_output
66 test_expect_success 'eol=crlf converts on output' '
67 set_attr eol=crlf &&
68 check_output
71 test_expect_success 'user-defined filters convert on output' '
72 set_attr filter=test &&
73 check_output
76 test_expect_success 'ident converts on output' '
77 set_attr ident &&
78 rm -f small large &&
79 git checkout small large &&
80 sed -n "s/Id: .*/Id: SHA/p" <small >small.clean &&
81 head -n 1 large >large.head &&
82 sed -n "s/Id: .*/Id: SHA/p" <large.head >large.clean &&
83 test_cmp small.clean large.clean
86 test_done