summaryrefslogtreecommitdiff
path: root/t/t4120-apply-popt.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t4120-apply-popt.sh')
-rwxr-xr-xt/t4120-apply-popt.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh
new file mode 100755
index 0000000000..b463b4f05c
--- /dev/null
+++ b/t/t4120-apply-popt.sh
@@ -0,0 +1,30 @@
+#!/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