blob: 66fa51591eb7ee8f102fd86e30e54af2da3ea310 [file] [log] [blame]
Catalin Marinascc189c22006-05-23 22:48:36 +01001#!/bin/sh
2#
3# Copyright (c) 2006 Catalin Marinas
4#
5
Junio C Hamano5be60072007-07-02 22:52:14 -07006test_description='git apply trying to add an ending line.
Catalin Marinascc189c22006-05-23 22:48:36 +01007
8'
9. ./test-lib.sh
10
11# setup
12
13cat >test-patch <<\EOF
14diff --git a/file b/file
15--- a/file
16+++ b/file
17@@ -1,2 +1,3 @@
18 a
19 b
20+c
21EOF
22
23echo 'a' >file
24echo 'b' >>file
25echo 'c' >>file
26
27test_expect_success setup \
Junio C Hamano5be60072007-07-02 22:52:14 -070028 'git update-index --add file'
Catalin Marinascc189c22006-05-23 22:48:36 +010029
30# test
31
Junio C Hamano41ac4142008-02-01 01:50:53 -080032test_expect_success 'apply at the end' \
Stephan Beyerd492b312008-07-12 17:47:52 +020033 'test_must_fail git apply --index test-patch'
Catalin Marinascc189c22006-05-23 22:48:36 +010034
Junio C Hamano65aadb92006-05-24 13:19:50 -070035cat >test-patch <<\EOF
36diff a/file b/file
37--- a/file
38+++ b/file
39@@ -1,2 +1,3 @@
40+a
41 b
42 c
43EOF
44
45echo >file 'a
46b
47c'
Junio C Hamano5be60072007-07-02 22:52:14 -070048git update-index file
Junio C Hamano65aadb92006-05-24 13:19:50 -070049
Junio C Hamano41ac4142008-02-01 01:50:53 -080050test_expect_success 'apply at the beginning' \
Stephan Beyerd492b312008-07-12 17:47:52 +020051 'test_must_fail git apply --index test-patch'
Junio C Hamano65aadb92006-05-24 13:19:50 -070052
Catalin Marinascc189c22006-05-23 22:48:36 +010053test_done