Staging
v0.5.1
https://github.com/git/git
Raw File
Tip revision: d599e0484f8ebac8cc50e9557a4c3d246826843d authored by Junio C Hamano on 24 April 2010, 01:27:17 UTC
Git 1.7.1
Tip revision: d599e04
t4120-apply-popt.sh
#!/bin/sh
#
# Copyright (c) 2007 Shawn O. Pearce
#

test_description='git apply -p handling.'

. ./test-lib.sh

test_expect_success setup '
	mkdir sub &&
	echo A >sub/file1 &&
	cp sub/file1 file1 &&
	git add sub/file1 &&
	echo B >sub/file1 &&
	git diff >patch.file &&
	rm sub/file1 &&
	rmdir sub
'

test_expect_success 'apply git diff with -p2' '
	git apply -p2 patch.file
'

test_expect_success 'apply with too large -p' '
	test_must_fail git apply --stat -p3 patch.file 2>err &&
	grep "removing 3 leading" err
'

test_done
back to top