3 # Copyright (C) 2015 Kyle J. McKay
6 test_description='git apply test patches with whitespace expansion.'
10 test_expect_success setup '
12 ## create test-N, patchN.patch, expect-N files
16 printf "\t%s\n" 1 2 3 4 5 6 >before &&
17 printf "\t%s\n" 1 2 3 >after &&
18 printf "%64s\n" a b c >>after &&
19 printf "\t%s\n" 4 5 6 >>after &&
20 test_expect_code 1 git diff --no-index before after >patch1.patch.raw &&
21 sed -e "s/before/test-1/" -e "s/after/test-1/" patch1.patch.raw >patch1.patch &&
22 printf "%64s\n" 1 2 3 4 5 6 >test-1 &&
23 printf "%64s\n" 1 2 3 a b c 4 5 6 >expect-1 &&
26 printf "\t%s\n" a b c d e f >before &&
27 printf "\t%s\n" a b c >after &&
32 printf "%63s%d\n" "" $x >>after
35 printf "\t%s\n" d e f >>after &&
36 test_expect_code 1 git diff --no-index before after >patch2.patch.raw &&
37 sed -e "s/before/test-2/" -e "s/after/test-2/" patch2.patch.raw >patch2.patch &&
38 printf "%64s\n" a b c d e f >test-2 &&
39 printf "%64s\n" a b c >expect-2 &&
43 printf "%63s%d\n" "" $x >>expect-2
46 printf "%64s\n" d e f >>expect-2 &&
49 printf "\t%s\n" a b c d e f >before &&
50 printf "\t%s\n" a b c >after &&
55 printf "%63s%02d\n" "" $x >>after
58 printf "\t%s\n" d e f >>after &&
59 test_expect_code 1 git diff --no-index before after >patch3.patch.raw &&
60 sed -e "s/before/test-3/" -e "s/after/test-3/" patch3.patch.raw >patch3.patch &&
61 printf "%64s\n" a b c d e f >test-3 &&
62 printf "%64s\n" a b c >expect-3 &&
66 printf "%63s%02d\n" "" $x >>expect-3
69 printf "%64s\n" d e f >>expect-3 &&
76 printf "\t%02d\n" $x >>before
80 printf "%64s\n" a b c >>after &&
83 printf "\t%02d\n" $x >>before
84 printf "\t%02d\n" $x >>after
87 test_expect_code 1 git diff --no-index before after >patch4.patch.raw &&
88 sed -e "s/before/test-4/" -e "s/after/test-4/" patch4.patch.raw >patch4.patch &&
93 printf "%63s%02d\n" "" $x >>test-4
96 cat test-4 >expect-4 &&
97 printf "%64s\n" a b c >>expect-4 &&
100 printf "%63s%02d\n" "" $x >>test-4
101 printf "%63s%02d\n" "" $x >>expect-4
105 git config core.whitespace tab-in-indent,tabwidth=63 &&
106 git config apply.whitespace fix
110 # Note that `patch` can successfully apply all patches when run
111 # with the --ignore-whitespace option.
115 test_expect_success 'apply with ws expansion (t=$t)' '
116 git apply patch$t.patch &&
117 test_cmp expect-$t test-$t