t4200: use cut instead of sed
[git/peff.git] / t / t4118-apply-empty-context.sh
blob1d531caf798b9e8dfbe17714ad1eb09be14f7f93
1 #!/bin/sh
3 # Copyright (c) 2006 Junio C Hamano
6 test_description='git apply with new style GNU diff with empty context
10 . ./test-lib.sh
12 test_expect_success setup '
14 echo; echo;
15 echo A; echo B; echo C;
16 echo;
17 } >file1 &&
18 cat file1 >file1.orig &&
20 cat file1 &&
21 echo Q | tr -d "\\012"
22 } >file2 &&
23 cat file2 >file2.orig
24 git add file1 file2 &&
25 sed -e "/^B/d" <file1.orig >file1 &&
26 sed -e "/^[BQ]/d" <file2.orig >file2 &&
27 echo Q | tr -d "\\012" >>file2 &&
28 cat file1 >file1.mods &&
29 cat file2 >file2.mods &&
30 git diff |
31 sed -e "s/^ \$//" >diff.output
34 test_expect_success 'apply --numstat' '
36 git apply --numstat diff.output >actual &&
38 echo "0 1 file1" &&
39 echo "0 1 file2"
40 } >expect &&
41 git diff expect actual
45 test_expect_success 'apply --apply' '
47 cat file1.orig >file1 &&
48 cat file2.orig >file2 &&
49 git update-index file1 file2 &&
50 git apply --index diff.output &&
51 git diff file1.mods file1 &&
52 git diff file2.mods file2
55 test_done