2007-04-04 19:19:14 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2007 Shawn O. Pearce
|
|
|
|
#
|
|
|
|
|
2007-07-03 09:52:14 +04:00
|
|
|
test_description='git apply -p handling.'
|
2007-04-04 19:19:14 +04:00
|
|
|
|
|
|
|
. ./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
|
|
|
|
'
|
|
|
|
|
2010-01-17 05:05:10 +03:00
|
|
|
test_expect_success 'apply with too large -p' '
|
|
|
|
test_must_fail git apply --stat -p3 patch.file 2>err &&
|
|
|
|
grep "removing 3 leading" err
|
|
|
|
'
|
|
|
|
|
2007-04-04 19:19:14 +04:00
|
|
|
test_done
|