]>
Commit | Line | Data |
---|---|---|
b507b465 LT |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2006 Junio C Hamano | |
4 | # | |
5 | ||
5be60078 | 6 | test_description='git apply with new style GNU diff with empty context |
b507b465 LT |
7 | |
8 | ' | |
9 | ||
f54f48fc ÆAB |
10 | |
11 | TEST_PASSES_SANITIZE_LEAK=true | |
b507b465 LT |
12 | . ./test-lib.sh |
13 | ||
14 | test_expect_success setup ' | |
08495412 | 15 | test_write_lines "" "" A B C "" >file1 && |
b507b465 LT |
16 | cat file1 >file1.orig && |
17 | { | |
18 | cat file1 && | |
19 | echo Q | tr -d "\\012" | |
20 | } >file2 && | |
72357046 | 21 | cat file2 >file2.orig && |
b507b465 LT |
22 | git add file1 file2 && |
23 | sed -e "/^B/d" <file1.orig >file1 && | |
325fb151 | 24 | cat file1 > file2 && |
3007a780 | 25 | echo Q | tr -d "\\012" >>file2 && |
b507b465 LT |
26 | cat file1 >file1.mods && |
27 | cat file2 >file2.mods && | |
28 | git diff | | |
29 | sed -e "s/^ \$//" >diff.output | |
30 | ' | |
31 | ||
32 | test_expect_success 'apply --numstat' ' | |
33 | ||
34 | git apply --numstat diff.output >actual && | |
35 | { | |
36 | echo "0 1 file1" && | |
37 | echo "0 1 file2" | |
38 | } >expect && | |
3af82863 | 39 | test_cmp expect actual |
b507b465 LT |
40 | |
41 | ' | |
42 | ||
43 | test_expect_success 'apply --apply' ' | |
44 | ||
45 | cat file1.orig >file1 && | |
46 | cat file2.orig >file2 && | |
47 | git update-index file1 file2 && | |
48 | git apply --index diff.output && | |
3af82863 JH |
49 | test_cmp file1.mods file1 && |
50 | test_cmp file2.mods file2 | |
b507b465 LT |
51 | ' |
52 | ||
53 | test_done |