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