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
14 test_expect_success setup
'
15 test_write_lines "" "" A B C "" >file1 &&
16 cat file1 >file1.orig &&
19 echo Q | tr -d "\\012"
21 cat file2 >file2.orig &&
22 git add file1 file2 &&
23 sed -e "/^B/d" <file1.orig >file1 &&
25 echo Q | tr -d "\\012" >>file2 &&
26 cat file1 >file1.mods &&
27 cat file2 >file2.mods &&
29 sed -e "s/^ \$//" >diff.output
32 test_expect_success
'apply --numstat' '
34 git apply --numstat diff.output >actual &&
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