Merge branch 'bb/iso-strict-utc'
[alt-git.git] / t / t4118-apply-empty-context.sh
blob69c9c48e72b4930b3ee21887c33122468f43be4a
1 #!/bin/sh
3 # Copyright (c) 2006 Junio C Hamano
6 test_description='git apply with new style GNU diff with empty context
11 TEST_PASSES_SANITIZE_LEAK=true
12 . ./test-lib.sh
14 test_expect_success setup '
15 test_write_lines "" "" A B C "" >file1 &&
16 cat file1 >file1.orig &&
18 cat file1 &&
19 echo Q | tr -d "\\012"
20 } >file2 &&
21 cat file2 >file2.orig &&
22 git add file1 file2 &&
23 sed -e "/^B/d" <file1.orig >file1 &&
24 cat file1 > file2 &&
25 echo Q | tr -d "\\012" >>file2 &&
26 cat file1 >file1.mods &&
27 cat file2 >file2.mods &&
28 git diff |
29 sed -e "s/^ \$//" >diff.output
32 test_expect_success 'apply --numstat' '
34 git apply --numstat diff.output >actual &&
36 echo "0 1 file1" &&
37 echo "0 1 file2"
38 } >expect &&
39 test_cmp expect actual
43 test_expect_success 'apply --apply' '
45 cat file1.orig >file1 &&
46 cat file2.orig >file2 &&
47 git update-index file1 file2 &&
48 git apply --index diff.output &&
49 test_cmp file1.mods file1 &&
50 test_cmp file2.mods file2
53 test_done