]> git.ipfire.org Git - thirdparty/git.git/blob - t/t4113-apply-ending.sh
The third batch
[thirdparty/git.git] / t / t4113-apply-ending.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2006 Catalin Marinas
4 #
5
6 test_description='git apply trying to add an ending line.
7
8 '
9 TEST_PASSES_SANITIZE_LEAK=true
10 . ./test-lib.sh
11
12 # setup
13
14 cat >test-patch <<\EOF
15 diff --git a/file b/file
16 --- a/file
17 +++ b/file
18 @@ -1,2 +1,3 @@
19 a
20 b
21 +c
22 EOF
23
24 echo 'a' >file
25 echo 'b' >>file
26 echo 'c' >>file
27
28 test_expect_success setup \
29 'git update-index --add file'
30
31 # test
32
33 test_expect_success 'apply at the end' \
34 'test_must_fail git apply --index test-patch'
35
36 cat >test-patch <<\EOF
37 diff a/file b/file
38 --- a/file
39 +++ b/file
40 @@ -1,2 +1,3 @@
41 +a
42 b
43 c
44 EOF
45
46 echo >file 'a
47 b
48 c'
49 git update-index file
50
51 test_expect_success 'apply at the beginning' \
52 'test_must_fail git apply --index test-patch'
53
54 test_done