Catalin Marinas | cc189c2 | 2006-05-23 22:48:36 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2006 Catalin Marinas |
| 4 | # |
| 5 | |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 6 | test_description='git apply trying to add an ending line. |
Catalin Marinas | cc189c2 | 2006-05-23 22:48:36 +0100 | [diff] [blame] | 7 | |
| 8 | ' |
| 9 | . ./test-lib.sh |
| 10 | |
| 11 | # setup |
| 12 | |
| 13 | cat >test-patch <<\EOF |
| 14 | diff --git a/file b/file |
| 15 | --- a/file |
| 16 | +++ b/file |
| 17 | @@ -1,2 +1,3 @@ |
| 18 | a |
| 19 | b |
| 20 | +c |
| 21 | EOF |
| 22 | |
| 23 | echo 'a' >file |
| 24 | echo 'b' >>file |
| 25 | echo 'c' >>file |
| 26 | |
| 27 | test_expect_success setup \ |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 28 | 'git update-index --add file' |
Catalin Marinas | cc189c2 | 2006-05-23 22:48:36 +0100 | [diff] [blame] | 29 | |
| 30 | # test |
| 31 | |
Junio C Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 32 | test_expect_success 'apply at the end' \ |
Stephan Beyer | d492b31 | 2008-07-12 17:47:52 +0200 | [diff] [blame] | 33 | 'test_must_fail git apply --index test-patch' |
Catalin Marinas | cc189c2 | 2006-05-23 22:48:36 +0100 | [diff] [blame] | 34 | |
Junio C Hamano | 65aadb9 | 2006-05-24 13:19:50 -0700 | [diff] [blame] | 35 | cat >test-patch <<\EOF |
| 36 | diff a/file b/file |
| 37 | --- a/file |
| 38 | +++ b/file |
| 39 | @@ -1,2 +1,3 @@ |
| 40 | +a |
| 41 | b |
| 42 | c |
| 43 | EOF |
| 44 | |
| 45 | echo >file 'a |
| 46 | b |
| 47 | c' |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 48 | git update-index file |
Junio C Hamano | 65aadb9 | 2006-05-24 13:19:50 -0700 | [diff] [blame] | 49 | |
Junio C Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 50 | test_expect_success 'apply at the beginning' \ |
Stephan Beyer | d492b31 | 2008-07-12 17:47:52 +0200 | [diff] [blame] | 51 | 'test_must_fail git apply --index test-patch' |
Junio C Hamano | 65aadb9 | 2006-05-24 13:19:50 -0700 | [diff] [blame] | 52 | |
Catalin Marinas | cc189c2 | 2006-05-23 22:48:36 +0100 | [diff] [blame] | 53 | test_done |