aboutsummaryrefslogtreecommitdiffstats
path: root/patch-test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--patch-test/1/def5
-rw-r--r--patch-test/1/new1
-rw-r--r--patch-test/1/old1
-rw-r--r--patch-test/1/patch4
-rw-r--r--patch-test/1/patch-c7
-rw-r--r--patch-test/1/patch-c07
-rw-r--r--patch-test/1/patch-c17
-rw-r--r--patch-test/1/patch-e3
-rw-r--r--patch-test/1/patch-u5
-rw-r--r--patch-test/1/patch-u05
-rw-r--r--patch-test/1/patch-u15
-rw-r--r--patch-test/10/def13
-rw-r--r--patch-test/10/new11
-rw-r--r--patch-test/10/old10
-rw-r--r--patch-test/10/patch2
-rw-r--r--patch-test/10/patch-c12
-rw-r--r--patch-test/10/patch-c06
-rw-r--r--patch-test/10/patch-c18
-rw-r--r--patch-test/10/patch-e3
-rw-r--r--patch-test/10/patch-u10
-rw-r--r--patch-test/10/patch-u04
-rw-r--r--patch-test/10/patch-u16
-rw-r--r--patch-test/11/def13
-rw-r--r--patch-test/11/new11
-rw-r--r--patch-test/11/old10
-rw-r--r--patch-test/11/patch2
-rw-r--r--patch-test/11/patch-c9
-rw-r--r--patch-test/11/patch-c06
-rw-r--r--patch-test/11/patch-c17
-rw-r--r--patch-test/11/patch-e3
-rw-r--r--patch-test/11/patch-u7
-rw-r--r--patch-test/11/patch-u04
-rw-r--r--patch-test/11/patch-u15
-rw-r--r--patch-test/12/def14
-rw-r--r--patch-test/12/new10
-rw-r--r--patch-test/12/old10
-rw-r--r--patch-test/12/patch4
-rw-r--r--patch-test/12/patch-c13
-rw-r--r--patch-test/12/patch-c07
-rw-r--r--patch-test/12/patch-c19
-rw-r--r--patch-test/12/patch-e3
-rw-r--r--patch-test/12/patch-u8
-rw-r--r--patch-test/12/patch-u05
-rw-r--r--patch-test/12/patch-u16
-rw-r--r--patch-test/13/def14
-rw-r--r--patch-test/13/new10
-rw-r--r--patch-test/13/old10
-rw-r--r--patch-test/13/patch4
-rw-r--r--patch-test/13/patch-c19
-rw-r--r--patch-test/13/patch-c07
-rw-r--r--patch-test/13/patch-c111
-rw-r--r--patch-test/13/patch-e3
-rw-r--r--patch-test/13/patch-u11
-rw-r--r--patch-test/13/patch-u05
-rw-r--r--patch-test/13/patch-u17
-rw-r--r--patch-test/14/def14
-rw-r--r--patch-test/14/new10
-rw-r--r--patch-test/14/old10
-rw-r--r--patch-test/14/patch4
-rw-r--r--patch-test/14/patch-c13
-rw-r--r--patch-test/14/patch-c07
-rw-r--r--patch-test/14/patch-c19
-rw-r--r--patch-test/14/patch-e3
-rw-r--r--patch-test/14/patch-u8
-rw-r--r--patch-test/14/patch-u05
-rw-r--r--patch-test/14/patch-u16
-rw-r--r--patch-test/15/def13
-rw-r--r--patch-test/15/new10
-rw-r--r--patch-test/15/old11
-rw-r--r--patch-test/15/patch2
-rw-r--r--patch-test/15/patch-c9
-rw-r--r--patch-test/15/patch-c06
-rw-r--r--patch-test/15/patch-c17
-rw-r--r--patch-test/15/patch-e1
-rw-r--r--patch-test/15/patch-u7
-rw-r--r--patch-test/15/patch-u04
-rw-r--r--patch-test/15/patch-u15
-rw-r--r--patch-test/16/def13
-rw-r--r--patch-test/16/new10
-rw-r--r--patch-test/16/old11
-rw-r--r--patch-test/16/patch2
-rw-r--r--patch-test/16/patch-c12
-rw-r--r--patch-test/16/patch-c06
-rw-r--r--patch-test/16/patch-c18
-rw-r--r--patch-test/16/patch-e1
-rw-r--r--patch-test/16/patch-u10
-rw-r--r--patch-test/16/patch-u04
-rw-r--r--patch-test/16/patch-u16
-rw-r--r--patch-test/17/def13
-rw-r--r--patch-test/17/new10
-rw-r--r--patch-test/17/old11
-rw-r--r--patch-test/17/patch2
-rw-r--r--patch-test/17/patch-c9
-rw-r--r--patch-test/17/patch-c06
-rw-r--r--patch-test/17/patch-c17
-rw-r--r--patch-test/17/patch-e1
-rw-r--r--patch-test/17/patch-u7
-rw-r--r--patch-test/17/patch-u04
-rw-r--r--patch-test/17/patch-u15
-rw-r--r--patch-test/18/def14
-rw-r--r--patch-test/18/new10
-rw-r--r--patch-test/18/old10
-rw-r--r--patch-test/18/patch4
-rw-r--r--patch-test/18/patch-c13
-rw-r--r--patch-test/18/patch-c07
-rw-r--r--patch-test/18/patch-c19
-rw-r--r--patch-test/18/patch-e3
-rw-r--r--patch-test/18/patch-u8
-rw-r--r--patch-test/18/patch-u05
-rw-r--r--patch-test/18/patch-u16
-rw-r--r--patch-test/19/def14
-rw-r--r--patch-test/19/new10
-rw-r--r--patch-test/19/old10
-rw-r--r--patch-test/19/patch4
-rw-r--r--patch-test/19/patch-c19
-rw-r--r--patch-test/19/patch-c07
-rw-r--r--patch-test/19/patch-c111
-rw-r--r--patch-test/19/patch-e3
-rw-r--r--patch-test/19/patch-u11
-rw-r--r--patch-test/19/patch-u05
-rw-r--r--patch-test/19/patch-u17
-rw-r--r--patch-test/2/def5
-rw-r--r--patch-test/2/new1
-rw-r--r--patch-test/2/old1
-rw-r--r--patch-test/2/patch6
-rw-r--r--patch-test/2/patch-c9
-rw-r--r--patch-test/2/patch-c09
-rw-r--r--patch-test/2/patch-c19
-rw-r--r--patch-test/2/patch-u7
-rw-r--r--patch-test/2/patch-u07
-rw-r--r--patch-test/2/patch-u17
-rw-r--r--patch-test/20/def14
-rw-r--r--patch-test/20/new10
-rw-r--r--patch-test/20/old10
-rw-r--r--patch-test/20/patch4
-rw-r--r--patch-test/20/patch-c13
-rw-r--r--patch-test/20/patch-c07
-rw-r--r--patch-test/20/patch-c19
-rw-r--r--patch-test/20/patch-e3
-rw-r--r--patch-test/20/patch-u8
-rw-r--r--patch-test/20/patch-u05
-rw-r--r--patch-test/20/patch-u16
-rw-r--r--patch-test/21/def48
-rw-r--r--patch-test/21/new37
-rw-r--r--patch-test/21/old34
-rw-r--r--patch-test/21/patch10
-rw-r--r--patch-test/21/patch-c46
-rw-r--r--patch-test/21/patch-c022
-rw-r--r--patch-test/21/patch-c130
-rw-r--r--patch-test/21/patch-e13
-rw-r--r--patch-test/21/patch-u36
-rw-r--r--patch-test/21/patch-u012
-rw-r--r--patch-test/21/patch-u120
-rw-r--r--patch-test/22/def48
-rw-r--r--patch-test/22/new34
-rw-r--r--patch-test/22/old37
-rw-r--r--patch-test/22/patch10
-rw-r--r--patch-test/22/patch-c46
-rw-r--r--patch-test/22/patch-c022
-rw-r--r--patch-test/22/patch-c130
-rw-r--r--patch-test/22/patch-e7
-rw-r--r--patch-test/22/patch-u36
-rw-r--r--patch-test/22/patch-u012
-rw-r--r--patch-test/22/patch-u120
-rw-r--r--patch-test/23/def41
-rw-r--r--patch-test/23/new26
-rw-r--r--patch-test/23/old26
-rw-r--r--patch-test/23/patch18
-rw-r--r--patch-test/23/patch-c47
-rw-r--r--patch-test/23/patch-c023
-rw-r--r--patch-test/23/patch-c131
-rw-r--r--patch-test/23/patch-e12
-rw-r--r--patch-test/23/patch-u29
-rw-r--r--patch-test/23/patch-u017
-rw-r--r--patch-test/23/patch-u121
-rw-r--r--patch-test/24/defbin0 -> 223 bytes
-rw-r--r--patch-test/24/newbin0 -> 123 bytes
-rw-r--r--patch-test/24/oldbin0 -> 124 bytes
-rw-r--r--patch-test/24/patchbin0 -> 83 bytes
-rw-r--r--patch-test/24/patch-cbin0 -> 495 bytes
-rw-r--r--patch-test/24/patch-c0bin0 -> 299 bytes
-rw-r--r--patch-test/24/patch-c1bin0 -> 391 bytes
-rw-r--r--patch-test/24/patch-ubin0 -> 288 bytes
-rw-r--r--patch-test/24/patch-u0bin0 -> 193 bytes
-rw-r--r--patch-test/24/patch-u1bin0 -> 237 bytes
-rw-r--r--patch-test/25/def51
-rw-r--r--patch-test/25/new37
-rw-r--r--patch-test/25/old40
-rw-r--r--patch-test/25/patch-c49
-rw-r--r--patch-test/25/patch-c022
-rw-r--r--patch-test/25/patch-c132
-rw-r--r--patch-test/25/patch-e7
-rw-r--r--patch-test/25/patch-u39
-rw-r--r--patch-test/25/patch-u012
-rw-r--r--patch-test/25/patch-u122
-rw-r--r--patch-test/26/def54
-rw-r--r--patch-test/26/new37
-rw-r--r--patch-test/26/old40
-rw-r--r--patch-test/26/patch-c54
-rw-r--r--patch-test/26/patch-c026
-rw-r--r--patch-test/26/patch-c136
-rw-r--r--patch-test/26/patch-e10
-rw-r--r--patch-test/26/patch-u41
-rw-r--r--patch-test/26/patch-u016
-rw-r--r--patch-test/26/patch-u125
-rw-r--r--patch-test/3/def5
-rw-r--r--patch-test/3/new1
-rw-r--r--patch-test/3/old1
-rw-r--r--patch-test/3/patch5
-rw-r--r--patch-test/3/patch-c8
-rw-r--r--patch-test/3/patch-c08
-rw-r--r--patch-test/3/patch-c18
-rw-r--r--patch-test/3/patch-u6
-rw-r--r--patch-test/3/patch-u06
-rw-r--r--patch-test/3/patch-u16
-rw-r--r--patch-test/4/def5
-rw-r--r--patch-test/4/new1
-rw-r--r--patch-test/4/old1
-rw-r--r--patch-test/4/patch5
-rw-r--r--patch-test/4/patch-c8
-rw-r--r--patch-test/4/patch-c08
-rw-r--r--patch-test/4/patch-c18
-rw-r--r--patch-test/4/patch-u6
-rw-r--r--patch-test/4/patch-u06
-rw-r--r--patch-test/4/patch-u16
-rw-r--r--patch-test/5/def3
-rw-r--r--patch-test/5/new1
-rw-r--r--patch-test/5/old0
-rw-r--r--patch-test/5/patch2
-rw-r--r--patch-test/5/patch-c6
-rw-r--r--patch-test/5/patch-c06
-rw-r--r--patch-test/5/patch-c16
-rw-r--r--patch-test/5/patch-e3
-rw-r--r--patch-test/5/patch-u4
-rw-r--r--patch-test/5/patch-u04
-rw-r--r--patch-test/5/patch-u14
-rw-r--r--patch-test/6/def3
-rw-r--r--patch-test/6/new1
-rw-r--r--patch-test/6/old0
-rw-r--r--patch-test/6/patch3
-rw-r--r--patch-test/6/patch-c7
-rw-r--r--patch-test/6/patch-c07
-rw-r--r--patch-test/6/patch-c17
-rw-r--r--patch-test/6/patch-u5
-rw-r--r--patch-test/6/patch-u05
-rw-r--r--patch-test/6/patch-u15
-rw-r--r--patch-test/7/def3
-rw-r--r--patch-test/7/new0
-rw-r--r--patch-test/7/old1
-rw-r--r--patch-test/7/patch2
-rw-r--r--patch-test/7/patch-c6
-rw-r--r--patch-test/7/patch-c06
-rw-r--r--patch-test/7/patch-c16
-rw-r--r--patch-test/7/patch-e1
-rw-r--r--patch-test/7/patch-u4
-rw-r--r--patch-test/7/patch-u04
-rw-r--r--patch-test/7/patch-u14
-rw-r--r--patch-test/8/def3
-rw-r--r--patch-test/8/new0
-rw-r--r--patch-test/8/old1
-rw-r--r--patch-test/8/patch3
-rw-r--r--patch-test/8/patch-c7
-rw-r--r--patch-test/8/patch-c07
-rw-r--r--patch-test/8/patch-c17
-rw-r--r--patch-test/8/patch-u5
-rw-r--r--patch-test/8/patch-u05
-rw-r--r--patch-test/8/patch-u15
-rw-r--r--patch-test/9/def13
-rw-r--r--patch-test/9/new11
-rw-r--r--patch-test/9/old10
-rw-r--r--patch-test/9/patch2
-rw-r--r--patch-test/9/patch-c9
-rw-r--r--patch-test/9/patch-c06
-rw-r--r--patch-test/9/patch-c17
-rw-r--r--patch-test/9/patch-e3
-rw-r--r--patch-test/9/patch-u7
-rw-r--r--patch-test/9/patch-u04
-rw-r--r--patch-test/9/patch-u15
-rwxr-xr-xpatch-test/__test120
-rw-r--r--patch-test/applied/new10
-rw-r--r--patch-test/applied/old11
-rw-r--r--patch-test/applied/patch-u13
-rw-r--r--patch-test/ed/new29
-rw-r--r--patch-test/ed/old25
-rw-r--r--patch-test/ed/patch-e26
-rw-r--r--patch-test/ed_i/new29
-rw-r--r--patch-test/ed_i/old25
-rw-r--r--patch-test/ed_i/patch-e26
-rw-r--r--patch-test/fuzzy/new31
-rw-r--r--patch-test/fuzzy/old30
-rw-r--r--patch-test/fuzzy/patch-u7
-rw-r--r--patch-test/lflag/new25
-rw-r--r--patch-test/lflag/old24
-rw-r--r--patch-test/lflag/patch-u18
-rw-r--r--patch-test/reppatch_def/def53
-rw-r--r--patch-test/reppatch_def/def.alt157
-rw-r--r--patch-test/reppatch_def/def.alt257
-rw-r--r--patch-test/reppatch_def/inter35
-rw-r--r--patch-test/reppatch_def/new29
-rw-r--r--patch-test/reppatch_def/old41
-rw-r--r--patch-test/reppatch_def/patch32
-rw-r--r--patch-test/reppatch_def/patch-c97
-rw-r--r--patch-test/reppatch_def/patch-c057
-rw-r--r--patch-test/reppatch_def/patch-c175
-rw-r--r--patch-test/reppatch_def/patch-e20
-rw-r--r--patch-test/reppatch_def/patch-u69
-rw-r--r--patch-test/reppatch_def/patch-u035
-rw-r--r--patch-test/reppatch_def/patch-u151
-rwxr-xr-xpatch-test/test1672
309 files changed, 5791 insertions, 0 deletions
diff --git a/patch-test/1/def b/patch-test/1/def
new file mode 100644
index 0000000..7c5bac5
--- /dev/null
+++ b/patch-test/1/def
@@ -0,0 +1,5 @@
+#ifndef x
+hi
+#else
+hej
+#endif
diff --git a/patch-test/1/new b/patch-test/1/new
new file mode 100644
index 0000000..1b5b67f
--- /dev/null
+++ b/patch-test/1/new
@@ -0,0 +1 @@
+hej
diff --git a/patch-test/1/old b/patch-test/1/old
new file mode 100644
index 0000000..45b983b
--- /dev/null
+++ b/patch-test/1/old
@@ -0,0 +1 @@
+hi
diff --git a/patch-test/1/patch b/patch-test/1/patch
new file mode 100644
index 0000000..9f4a35f
--- /dev/null
+++ b/patch-test/1/patch
@@ -0,0 +1,4 @@
+1c1
+< hi
+---
+> hej
diff --git a/patch-test/1/patch-c b/patch-test/1/patch-c
new file mode 100644
index 0000000..5946c8d
--- /dev/null
+++ b/patch-test/1/patch-c
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:33:39.558574804 +0100
+--- new 2016-03-11 09:33:39.591908150 +0100
+***************
+*** 1 ****
+! hi
+--- 1 ----
+! hej
diff --git a/patch-test/1/patch-c0 b/patch-test/1/patch-c0
new file mode 100644
index 0000000..5946c8d
--- /dev/null
+++ b/patch-test/1/patch-c0
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:33:39.558574804 +0100
+--- new 2016-03-11 09:33:39.591908150 +0100
+***************
+*** 1 ****
+! hi
+--- 1 ----
+! hej
diff --git a/patch-test/1/patch-c1 b/patch-test/1/patch-c1
new file mode 100644
index 0000000..5946c8d
--- /dev/null
+++ b/patch-test/1/patch-c1
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:33:39.558574804 +0100
+--- new 2016-03-11 09:33:39.591908150 +0100
+***************
+*** 1 ****
+! hi
+--- 1 ----
+! hej
diff --git a/patch-test/1/patch-e b/patch-test/1/patch-e
new file mode 100644
index 0000000..84d151b
--- /dev/null
+++ b/patch-test/1/patch-e
@@ -0,0 +1,3 @@
+1c
+hej
+.
diff --git a/patch-test/1/patch-u b/patch-test/1/patch-u
new file mode 100644
index 0000000..ecc010d
--- /dev/null
+++ b/patch-test/1/patch-u
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:33:39.558574804 +0100
++++ new 2016-03-11 09:33:39.591908150 +0100
+@@ -1 +1 @@
+-hi
++hej
diff --git a/patch-test/1/patch-u0 b/patch-test/1/patch-u0
new file mode 100644
index 0000000..ecc010d
--- /dev/null
+++ b/patch-test/1/patch-u0
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:33:39.558574804 +0100
++++ new 2016-03-11 09:33:39.591908150 +0100
+@@ -1 +1 @@
+-hi
++hej
diff --git a/patch-test/1/patch-u1 b/patch-test/1/patch-u1
new file mode 100644
index 0000000..ecc010d
--- /dev/null
+++ b/patch-test/1/patch-u1
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:33:39.558574804 +0100
++++ new 2016-03-11 09:33:39.591908150 +0100
+@@ -1 +1 @@
+-hi
++hej
diff --git a/patch-test/10/def b/patch-test/10/def
new file mode 100644
index 0000000..89f88fc
--- /dev/null
+++ b/patch-test/10/def
@@ -0,0 +1,13 @@
+a
+a
+a
+a
+a
+#ifdef x
+b
+#endif
+a
+a
+a
+a
+a
diff --git a/patch-test/10/new b/patch-test/10/new
new file mode 100644
index 0000000..ff53b65
--- /dev/null
+++ b/patch-test/10/new
@@ -0,0 +1,11 @@
+a
+a
+a
+a
+a
+b
+a
+a
+a
+a
+a
diff --git a/patch-test/10/old b/patch-test/10/old
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/10/old
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/10/patch b/patch-test/10/patch
new file mode 100644
index 0000000..f3aad93
--- /dev/null
+++ b/patch-test/10/patch
@@ -0,0 +1,2 @@
+5a6
+> b
diff --git a/patch-test/10/patch-c b/patch-test/10/patch-c
new file mode 100644
index 0000000..e4c53ff
--- /dev/null
+++ b/patch-test/10/patch-c
@@ -0,0 +1,12 @@
+*** old 2016-03-11 09:37:25.001994752 +0100
+--- new 2016-03-11 09:37:43.288668426 +0100
+***************
+*** 3,8 ****
+--- 3,9 ----
+ a
+ a
+ a
++ b
+ a
+ a
+ a
diff --git a/patch-test/10/patch-c0 b/patch-test/10/patch-c0
new file mode 100644
index 0000000..2089535
--- /dev/null
+++ b/patch-test/10/patch-c0
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:37:25.001994752 +0100
+--- new 2016-03-11 09:37:43.288668426 +0100
+***************
+*** 5 ****
+--- 6 ----
++ b
diff --git a/patch-test/10/patch-c1 b/patch-test/10/patch-c1
new file mode 100644
index 0000000..46216e8
--- /dev/null
+++ b/patch-test/10/patch-c1
@@ -0,0 +1,8 @@
+*** old 2016-03-11 09:37:25.001994752 +0100
+--- new 2016-03-11 09:37:43.288668426 +0100
+***************
+*** 5,6 ****
+--- 5,7 ----
+ a
++ b
+ a
diff --git a/patch-test/10/patch-e b/patch-test/10/patch-e
new file mode 100644
index 0000000..12f4288
--- /dev/null
+++ b/patch-test/10/patch-e
@@ -0,0 +1,3 @@
+5a
+b
+.
diff --git a/patch-test/10/patch-u b/patch-test/10/patch-u
new file mode 100644
index 0000000..afc2788
--- /dev/null
+++ b/patch-test/10/patch-u
@@ -0,0 +1,10 @@
+--- old 2016-03-11 09:37:25.001994752 +0100
++++ new 2016-03-11 09:37:43.288668426 +0100
+@@ -3,6 +3,7 @@
+ a
+ a
+ a
++b
+ a
+ a
+ a
diff --git a/patch-test/10/patch-u0 b/patch-test/10/patch-u0
new file mode 100644
index 0000000..abe854c
--- /dev/null
+++ b/patch-test/10/patch-u0
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:37:25.001994752 +0100
++++ new 2016-03-11 09:37:43.288668426 +0100
+@@ -5,0 +6 @@
++b
diff --git a/patch-test/10/patch-u1 b/patch-test/10/patch-u1
new file mode 100644
index 0000000..58d184c
--- /dev/null
+++ b/patch-test/10/patch-u1
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:37:25.001994752 +0100
++++ new 2016-03-11 09:37:43.288668426 +0100
+@@ -5,2 +5,3 @@
+ a
++b
+ a
diff --git a/patch-test/11/def b/patch-test/11/def
new file mode 100644
index 0000000..38eba75
--- /dev/null
+++ b/patch-test/11/def
@@ -0,0 +1,13 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+#ifdef x
+b
+#endif
diff --git a/patch-test/11/new b/patch-test/11/new
new file mode 100644
index 0000000..e0e1eac
--- /dev/null
+++ b/patch-test/11/new
@@ -0,0 +1,11 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+b
diff --git a/patch-test/11/old b/patch-test/11/old
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/11/old
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/11/patch b/patch-test/11/patch
new file mode 100644
index 0000000..bc1a6a7
--- /dev/null
+++ b/patch-test/11/patch
@@ -0,0 +1,2 @@
+10a11
+> b
diff --git a/patch-test/11/patch-c b/patch-test/11/patch-c
new file mode 100644
index 0000000..73a68d3
--- /dev/null
+++ b/patch-test/11/patch-c
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:37:58.848674390 +0100
+--- new 2016-03-11 09:38:08.672011482 +0100
+***************
+*** 8,10 ****
+--- 8,11 ----
+ a
+ a
+ a
++ b
diff --git a/patch-test/11/patch-c0 b/patch-test/11/patch-c0
new file mode 100644
index 0000000..aec1751
--- /dev/null
+++ b/patch-test/11/patch-c0
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:37:58.848674390 +0100
+--- new 2016-03-11 09:38:08.672011482 +0100
+***************
+*** 10 ****
+--- 11 ----
++ b
diff --git a/patch-test/11/patch-c1 b/patch-test/11/patch-c1
new file mode 100644
index 0000000..d362055
--- /dev/null
+++ b/patch-test/11/patch-c1
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:37:58.848674390 +0100
+--- new 2016-03-11 09:38:08.672011482 +0100
+***************
+*** 10 ****
+--- 10,11 ----
+ a
++ b
diff --git a/patch-test/11/patch-e b/patch-test/11/patch-e
new file mode 100644
index 0000000..09e7faf
--- /dev/null
+++ b/patch-test/11/patch-e
@@ -0,0 +1,3 @@
+10a
+b
+.
diff --git a/patch-test/11/patch-u b/patch-test/11/patch-u
new file mode 100644
index 0000000..2cb84b7
--- /dev/null
+++ b/patch-test/11/patch-u
@@ -0,0 +1,7 @@
+--- old 2016-03-11 09:37:58.848674390 +0100
++++ new 2016-03-11 09:38:08.672011482 +0100
+@@ -8,3 +8,4 @@
+ a
+ a
+ a
++b
diff --git a/patch-test/11/patch-u0 b/patch-test/11/patch-u0
new file mode 100644
index 0000000..6bdaceb
--- /dev/null
+++ b/patch-test/11/patch-u0
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:37:58.848674390 +0100
++++ new 2016-03-11 09:38:08.672011482 +0100
+@@ -10,0 +11 @@
++b
diff --git a/patch-test/11/patch-u1 b/patch-test/11/patch-u1
new file mode 100644
index 0000000..b5f1ff3
--- /dev/null
+++ b/patch-test/11/patch-u1
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:37:58.848674390 +0100
++++ new 2016-03-11 09:38:08.672011482 +0100
+@@ -10 +10,2 @@
+ a
++b
diff --git a/patch-test/12/def b/patch-test/12/def
new file mode 100644
index 0000000..8509efc
--- /dev/null
+++ b/patch-test/12/def
@@ -0,0 +1,14 @@
+#ifndef x
+a
+#else
+b
+#endif
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/12/new b/patch-test/12/new
new file mode 100644
index 0000000..a30ba66
--- /dev/null
+++ b/patch-test/12/new
@@ -0,0 +1,10 @@
+b
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/12/old b/patch-test/12/old
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/12/old
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/12/patch b/patch-test/12/patch
new file mode 100644
index 0000000..e6ff064
--- /dev/null
+++ b/patch-test/12/patch
@@ -0,0 +1,4 @@
+1c1
+< a
+---
+> b
diff --git a/patch-test/12/patch-c b/patch-test/12/patch-c
new file mode 100644
index 0000000..23151c3
--- /dev/null
+++ b/patch-test/12/patch-c
@@ -0,0 +1,13 @@
+*** old 2016-03-11 09:39:22.298706323 +0100
+--- new 2016-03-11 09:39:46.818715698 +0100
+***************
+*** 1,4 ****
+! a
+ a
+ a
+ a
+--- 1,4 ----
+! b
+ a
+ a
+ a
diff --git a/patch-test/12/patch-c0 b/patch-test/12/patch-c0
new file mode 100644
index 0000000..afa886a
--- /dev/null
+++ b/patch-test/12/patch-c0
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:39:22.298706323 +0100
+--- new 2016-03-11 09:39:46.818715698 +0100
+***************
+*** 1 ****
+! a
+--- 1 ----
+! b
diff --git a/patch-test/12/patch-c1 b/patch-test/12/patch-c1
new file mode 100644
index 0000000..6891f18
--- /dev/null
+++ b/patch-test/12/patch-c1
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:39:22.298706323 +0100
+--- new 2016-03-11 09:39:46.818715698 +0100
+***************
+*** 1,2 ****
+! a
+ a
+--- 1,2 ----
+! b
+ a
diff --git a/patch-test/12/patch-e b/patch-test/12/patch-e
new file mode 100644
index 0000000..70aac38
--- /dev/null
+++ b/patch-test/12/patch-e
@@ -0,0 +1,3 @@
+1c
+b
+.
diff --git a/patch-test/12/patch-u b/patch-test/12/patch-u
new file mode 100644
index 0000000..0ff4c73
--- /dev/null
+++ b/patch-test/12/patch-u
@@ -0,0 +1,8 @@
+--- old 2016-03-11 09:39:22.298706323 +0100
++++ new 2016-03-11 09:39:46.818715698 +0100
+@@ -1,4 +1,4 @@
+-a
++b
+ a
+ a
+ a
diff --git a/patch-test/12/patch-u0 b/patch-test/12/patch-u0
new file mode 100644
index 0000000..d8c63b3
--- /dev/null
+++ b/patch-test/12/patch-u0
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:39:22.298706323 +0100
++++ new 2016-03-11 09:39:46.818715698 +0100
+@@ -1 +1 @@
+-a
++b
diff --git a/patch-test/12/patch-u1 b/patch-test/12/patch-u1
new file mode 100644
index 0000000..edee2aa
--- /dev/null
+++ b/patch-test/12/patch-u1
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:39:22.298706323 +0100
++++ new 2016-03-11 09:39:46.818715698 +0100
+@@ -1,2 +1,2 @@
+-a
++b
+ a
diff --git a/patch-test/13/def b/patch-test/13/def
new file mode 100644
index 0000000..e77bb5a
--- /dev/null
+++ b/patch-test/13/def
@@ -0,0 +1,14 @@
+a
+a
+a
+a
+a
+#ifndef x
+a
+#else
+b
+#endif
+a
+a
+a
+a
diff --git a/patch-test/13/new b/patch-test/13/new
new file mode 100644
index 0000000..a0a47f0
--- /dev/null
+++ b/patch-test/13/new
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+b
+a
+a
+a
+a
diff --git a/patch-test/13/old b/patch-test/13/old
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/13/old
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/13/patch b/patch-test/13/patch
new file mode 100644
index 0000000..6aea182
--- /dev/null
+++ b/patch-test/13/patch
@@ -0,0 +1,4 @@
+6c6
+< a
+---
+> b
diff --git a/patch-test/13/patch-c b/patch-test/13/patch-c
new file mode 100644
index 0000000..ac5b0c5
--- /dev/null
+++ b/patch-test/13/patch-c
@@ -0,0 +1,19 @@
+*** old 2016-03-11 09:39:24.592040532 +0100
+--- new 2016-03-11 09:39:57.682053183 +0100
+***************
+*** 3,9 ****
+ a
+ a
+ a
+! a
+ a
+ a
+ a
+--- 3,9 ----
+ a
+ a
+ a
+! b
+ a
+ a
+ a
diff --git a/patch-test/13/patch-c0 b/patch-test/13/patch-c0
new file mode 100644
index 0000000..2c03c82
--- /dev/null
+++ b/patch-test/13/patch-c0
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:39:24.592040532 +0100
+--- new 2016-03-11 09:39:57.682053183 +0100
+***************
+*** 6 ****
+! a
+--- 6 ----
+! b
diff --git a/patch-test/13/patch-c1 b/patch-test/13/patch-c1
new file mode 100644
index 0000000..55c0ebf
--- /dev/null
+++ b/patch-test/13/patch-c1
@@ -0,0 +1,11 @@
+*** old 2016-03-11 09:39:24.592040532 +0100
+--- new 2016-03-11 09:39:57.682053183 +0100
+***************
+*** 5,7 ****
+ a
+! a
+ a
+--- 5,7 ----
+ a
+! b
+ a
diff --git a/patch-test/13/patch-e b/patch-test/13/patch-e
new file mode 100644
index 0000000..87c22a3
--- /dev/null
+++ b/patch-test/13/patch-e
@@ -0,0 +1,3 @@
+6c
+b
+.
diff --git a/patch-test/13/patch-u b/patch-test/13/patch-u
new file mode 100644
index 0000000..2abdbd2
--- /dev/null
+++ b/patch-test/13/patch-u
@@ -0,0 +1,11 @@
+--- old 2016-03-11 09:39:24.592040532 +0100
++++ new 2016-03-11 09:39:57.682053183 +0100
+@@ -3,7 +3,7 @@
+ a
+ a
+ a
+-a
++b
+ a
+ a
+ a
diff --git a/patch-test/13/patch-u0 b/patch-test/13/patch-u0
new file mode 100644
index 0000000..b7a39f6
--- /dev/null
+++ b/patch-test/13/patch-u0
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:39:24.592040532 +0100
++++ new 2016-03-11 09:39:57.682053183 +0100
+@@ -6 +6 @@
+-a
++b
diff --git a/patch-test/13/patch-u1 b/patch-test/13/patch-u1
new file mode 100644
index 0000000..680c3ed
--- /dev/null
+++ b/patch-test/13/patch-u1
@@ -0,0 +1,7 @@
+--- old 2016-03-11 09:39:24.592040532 +0100
++++ new 2016-03-11 09:39:57.682053183 +0100
+@@ -5,3 +5,3 @@
+ a
+-a
++b
+ a
diff --git a/patch-test/14/def b/patch-test/14/def
new file mode 100644
index 0000000..b88d511
--- /dev/null
+++ b/patch-test/14/def
@@ -0,0 +1,14 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+#ifndef x
+a
+#else
+b
+#endif
diff --git a/patch-test/14/new b/patch-test/14/new
new file mode 100644
index 0000000..105ab99
--- /dev/null
+++ b/patch-test/14/new
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+b
diff --git a/patch-test/14/old b/patch-test/14/old
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/14/old
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/14/patch b/patch-test/14/patch
new file mode 100644
index 0000000..21a8503
--- /dev/null
+++ b/patch-test/14/patch
@@ -0,0 +1,4 @@
+10c10
+< a
+---
+> b
diff --git a/patch-test/14/patch-c b/patch-test/14/patch-c
new file mode 100644
index 0000000..abf7a9d
--- /dev/null
+++ b/patch-test/14/patch-c
@@ -0,0 +1,13 @@
+*** old 2016-03-11 09:39:27.112041502 +0100
+--- new 2016-03-11 09:40:04.178722330 +0100
+***************
+*** 7,10 ****
+ a
+ a
+ a
+! a
+--- 7,10 ----
+ a
+ a
+ a
+! b
diff --git a/patch-test/14/patch-c0 b/patch-test/14/patch-c0
new file mode 100644
index 0000000..c8f361f
--- /dev/null
+++ b/patch-test/14/patch-c0
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:39:27.112041502 +0100
+--- new 2016-03-11 09:40:04.178722330 +0100
+***************
+*** 10 ****
+! a
+--- 10 ----
+! b
diff --git a/patch-test/14/patch-c1 b/patch-test/14/patch-c1
new file mode 100644
index 0000000..97015fa
--- /dev/null
+++ b/patch-test/14/patch-c1
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:39:27.112041502 +0100
+--- new 2016-03-11 09:40:04.178722330 +0100
+***************
+*** 9,10 ****
+ a
+! a
+--- 9,10 ----
+ a
+! b
diff --git a/patch-test/14/patch-e b/patch-test/14/patch-e
new file mode 100644
index 0000000..d0988dc
--- /dev/null
+++ b/patch-test/14/patch-e
@@ -0,0 +1,3 @@
+10c
+b
+.
diff --git a/patch-test/14/patch-u b/patch-test/14/patch-u
new file mode 100644
index 0000000..8b06865
--- /dev/null
+++ b/patch-test/14/patch-u
@@ -0,0 +1,8 @@
+--- old 2016-03-11 09:39:27.112041502 +0100
++++ new 2016-03-11 09:40:04.178722330 +0100
+@@ -7,4 +7,4 @@
+ a
+ a
+ a
+-a
++b
diff --git a/patch-test/14/patch-u0 b/patch-test/14/patch-u0
new file mode 100644
index 0000000..32d100b
--- /dev/null
+++ b/patch-test/14/patch-u0
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:39:27.112041502 +0100
++++ new 2016-03-11 09:40:04.178722330 +0100
+@@ -10 +10 @@
+-a
++b
diff --git a/patch-test/14/patch-u1 b/patch-test/14/patch-u1
new file mode 100644
index 0000000..5235232
--- /dev/null
+++ b/patch-test/14/patch-u1
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:39:27.112041502 +0100
++++ new 2016-03-11 09:40:04.178722330 +0100
+@@ -9,2 +9,2 @@
+ a
+-a
++b
diff --git a/patch-test/15/def b/patch-test/15/def
new file mode 100644
index 0000000..5c4a395
--- /dev/null
+++ b/patch-test/15/def
@@ -0,0 +1,13 @@
+#ifndef x
+b
+#endif
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/15/new b/patch-test/15/new
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/15/new
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/15/old b/patch-test/15/old
new file mode 100644
index 0000000..6a57515
--- /dev/null
+++ b/patch-test/15/old
@@ -0,0 +1,11 @@
+b
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/15/patch b/patch-test/15/patch
new file mode 100644
index 0000000..c704361
--- /dev/null
+++ b/patch-test/15/patch
@@ -0,0 +1,2 @@
+1d0
+< b
diff --git a/patch-test/15/patch-c b/patch-test/15/patch-c
new file mode 100644
index 0000000..43593c7
--- /dev/null
+++ b/patch-test/15/patch-c
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:40:37.218734948 +0100
+--- new 2016-03-11 09:40:37.218734948 +0100
+***************
+*** 1,4 ****
+- b
+ a
+ a
+ a
+--- 1,3 ----
diff --git a/patch-test/15/patch-c0 b/patch-test/15/patch-c0
new file mode 100644
index 0000000..078e5f2
--- /dev/null
+++ b/patch-test/15/patch-c0
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:40:37.218734948 +0100
+--- new 2016-03-11 09:40:37.218734948 +0100
+***************
+*** 1 ****
+- b
+--- 0 ----
diff --git a/patch-test/15/patch-c1 b/patch-test/15/patch-c1
new file mode 100644
index 0000000..c560b7d
--- /dev/null
+++ b/patch-test/15/patch-c1
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:40:37.218734948 +0100
+--- new 2016-03-11 09:40:37.218734948 +0100
+***************
+*** 1,2 ****
+- b
+ a
+--- 1 ----
diff --git a/patch-test/15/patch-e b/patch-test/15/patch-e
new file mode 100644
index 0000000..b6fe86e
--- /dev/null
+++ b/patch-test/15/patch-e
@@ -0,0 +1 @@
+1d
diff --git a/patch-test/15/patch-u b/patch-test/15/patch-u
new file mode 100644
index 0000000..3a68630
--- /dev/null
+++ b/patch-test/15/patch-u
@@ -0,0 +1,7 @@
+--- old 2016-03-11 09:40:37.218734948 +0100
++++ new 2016-03-11 09:40:37.218734948 +0100
+@@ -1,4 +1,3 @@
+-b
+ a
+ a
+ a
diff --git a/patch-test/15/patch-u0 b/patch-test/15/patch-u0
new file mode 100644
index 0000000..f403b00
--- /dev/null
+++ b/patch-test/15/patch-u0
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:40:37.218734948 +0100
++++ new 2016-03-11 09:40:37.218734948 +0100
+@@ -1 +0,0 @@
+-b
diff --git a/patch-test/15/patch-u1 b/patch-test/15/patch-u1
new file mode 100644
index 0000000..715306d
--- /dev/null
+++ b/patch-test/15/patch-u1
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:40:37.218734948 +0100
++++ new 2016-03-11 09:40:37.218734948 +0100
+@@ -1,2 +1 @@
+-b
+ a
diff --git a/patch-test/16/def b/patch-test/16/def
new file mode 100644
index 0000000..4f3bd6e
--- /dev/null
+++ b/patch-test/16/def
@@ -0,0 +1,13 @@
+a
+a
+a
+a
+a
+#ifndef x
+b
+#endif
+a
+a
+a
+a
+a
diff --git a/patch-test/16/new b/patch-test/16/new
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/16/new
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/16/old b/patch-test/16/old
new file mode 100644
index 0000000..ff53b65
--- /dev/null
+++ b/patch-test/16/old
@@ -0,0 +1,11 @@
+a
+a
+a
+a
+a
+b
+a
+a
+a
+a
+a
diff --git a/patch-test/16/patch b/patch-test/16/patch
new file mode 100644
index 0000000..cdaf35a
--- /dev/null
+++ b/patch-test/16/patch
@@ -0,0 +1,2 @@
+6d5
+< b
diff --git a/patch-test/16/patch-c b/patch-test/16/patch-c
new file mode 100644
index 0000000..c5b8133
--- /dev/null
+++ b/patch-test/16/patch-c
@@ -0,0 +1,12 @@
+*** old 2016-03-11 09:40:40.032069357 +0100
+--- new 2016-03-11 09:40:40.032069357 +0100
+***************
+*** 3,9 ****
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+--- 3,8 ----
diff --git a/patch-test/16/patch-c0 b/patch-test/16/patch-c0
new file mode 100644
index 0000000..9b67d7e
--- /dev/null
+++ b/patch-test/16/patch-c0
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:40:40.032069357 +0100
+--- new 2016-03-11 09:40:40.032069357 +0100
+***************
+*** 6 ****
+- b
+--- 5 ----
diff --git a/patch-test/16/patch-c1 b/patch-test/16/patch-c1
new file mode 100644
index 0000000..b34cf08
--- /dev/null
+++ b/patch-test/16/patch-c1
@@ -0,0 +1,8 @@
+*** old 2016-03-11 09:40:40.032069357 +0100
+--- new 2016-03-11 09:40:40.032069357 +0100
+***************
+*** 5,7 ****
+ a
+- b
+ a
+--- 5,6 ----
diff --git a/patch-test/16/patch-e b/patch-test/16/patch-e
new file mode 100644
index 0000000..d42efc0
--- /dev/null
+++ b/patch-test/16/patch-e
@@ -0,0 +1 @@
+6d
diff --git a/patch-test/16/patch-u b/patch-test/16/patch-u
new file mode 100644
index 0000000..53e2fbd
--- /dev/null
+++ b/patch-test/16/patch-u
@@ -0,0 +1,10 @@
+--- old 2016-03-11 09:40:40.032069357 +0100
++++ new 2016-03-11 09:40:40.032069357 +0100
+@@ -3,7 +3,6 @@
+ a
+ a
+ a
+-b
+ a
+ a
+ a
diff --git a/patch-test/16/patch-u0 b/patch-test/16/patch-u0
new file mode 100644
index 0000000..2c556b9
--- /dev/null
+++ b/patch-test/16/patch-u0
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:40:40.032069357 +0100
++++ new 2016-03-11 09:40:40.032069357 +0100
+@@ -6 +5,0 @@
+-b
diff --git a/patch-test/16/patch-u1 b/patch-test/16/patch-u1
new file mode 100644
index 0000000..6fedfb7
--- /dev/null
+++ b/patch-test/16/patch-u1
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:40:40.032069357 +0100
++++ new 2016-03-11 09:40:40.032069357 +0100
+@@ -5,3 +5,2 @@
+ a
+-b
+ a
diff --git a/patch-test/17/def b/patch-test/17/def
new file mode 100644
index 0000000..b2bd02e
--- /dev/null
+++ b/patch-test/17/def
@@ -0,0 +1,13 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+#ifndef x
+b
+#endif
diff --git a/patch-test/17/new b/patch-test/17/new
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/17/new
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/17/old b/patch-test/17/old
new file mode 100644
index 0000000..e0e1eac
--- /dev/null
+++ b/patch-test/17/old
@@ -0,0 +1,11 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+b
diff --git a/patch-test/17/patch b/patch-test/17/patch
new file mode 100644
index 0000000..482dba1
--- /dev/null
+++ b/patch-test/17/patch
@@ -0,0 +1,2 @@
+11d10
+< b
diff --git a/patch-test/17/patch-c b/patch-test/17/patch-c
new file mode 100644
index 0000000..2bdf492
--- /dev/null
+++ b/patch-test/17/patch-c
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:40:45.835404909 +0100
+--- new 2016-03-11 09:40:45.835404909 +0100
+***************
+*** 8,11 ****
+ a
+ a
+ a
+- b
+--- 8,10 ----
diff --git a/patch-test/17/patch-c0 b/patch-test/17/patch-c0
new file mode 100644
index 0000000..5027c2c
--- /dev/null
+++ b/patch-test/17/patch-c0
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:40:45.835404909 +0100
+--- new 2016-03-11 09:40:45.835404909 +0100
+***************
+*** 11 ****
+- b
+--- 10 ----
diff --git a/patch-test/17/patch-c1 b/patch-test/17/patch-c1
new file mode 100644
index 0000000..302e3af
--- /dev/null
+++ b/patch-test/17/patch-c1
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:40:45.835404909 +0100
+--- new 2016-03-11 09:40:45.835404909 +0100
+***************
+*** 10,11 ****
+ a
+- b
+--- 10 ----
diff --git a/patch-test/17/patch-e b/patch-test/17/patch-e
new file mode 100644
index 0000000..ade911e
--- /dev/null
+++ b/patch-test/17/patch-e
@@ -0,0 +1 @@
+11d
diff --git a/patch-test/17/patch-u b/patch-test/17/patch-u
new file mode 100644
index 0000000..61c81f1
--- /dev/null
+++ b/patch-test/17/patch-u
@@ -0,0 +1,7 @@
+--- old 2016-03-11 09:40:45.835404909 +0100
++++ new 2016-03-11 09:40:45.835404909 +0100
+@@ -8,4 +8,3 @@
+ a
+ a
+ a
+-b
diff --git a/patch-test/17/patch-u0 b/patch-test/17/patch-u0
new file mode 100644
index 0000000..95f7e67
--- /dev/null
+++ b/patch-test/17/patch-u0
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:40:45.835404909 +0100
++++ new 2016-03-11 09:40:45.835404909 +0100
+@@ -11 +10,0 @@
+-b
diff --git a/patch-test/17/patch-u1 b/patch-test/17/patch-u1
new file mode 100644
index 0000000..a06d628
--- /dev/null
+++ b/patch-test/17/patch-u1
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:40:45.835404909 +0100
++++ new 2016-03-11 09:40:45.835404909 +0100
+@@ -10,2 +10 @@
+ a
+-b
diff --git a/patch-test/18/def b/patch-test/18/def
new file mode 100644
index 0000000..77d9ab4
--- /dev/null
+++ b/patch-test/18/def
@@ -0,0 +1,14 @@
+#ifndef x
+b
+#else
+a
+#endif
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/18/new b/patch-test/18/new
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/18/new
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/18/old b/patch-test/18/old
new file mode 100644
index 0000000..a30ba66
--- /dev/null
+++ b/patch-test/18/old
@@ -0,0 +1,10 @@
+b
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/18/patch b/patch-test/18/patch
new file mode 100644
index 0000000..2f1f38a
--- /dev/null
+++ b/patch-test/18/patch
@@ -0,0 +1,4 @@
+1c1
+< b
+---
+> a
diff --git a/patch-test/18/patch-c b/patch-test/18/patch-c
new file mode 100644
index 0000000..4934508
--- /dev/null
+++ b/patch-test/18/patch-c
@@ -0,0 +1,13 @@
+*** old 2016-03-11 09:40:47.945405710 +0100
+--- new 2016-03-11 09:40:47.945405710 +0100
+***************
+*** 1,4 ****
+! b
+ a
+ a
+ a
+--- 1,4 ----
+! a
+ a
+ a
+ a
diff --git a/patch-test/18/patch-c0 b/patch-test/18/patch-c0
new file mode 100644
index 0000000..0195a9e
--- /dev/null
+++ b/patch-test/18/patch-c0
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:40:47.945405710 +0100
+--- new 2016-03-11 09:40:47.945405710 +0100
+***************
+*** 1 ****
+! b
+--- 1 ----
+! a
diff --git a/patch-test/18/patch-c1 b/patch-test/18/patch-c1
new file mode 100644
index 0000000..596cbc3
--- /dev/null
+++ b/patch-test/18/patch-c1
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:40:47.945405710 +0100
+--- new 2016-03-11 09:40:47.945405710 +0100
+***************
+*** 1,2 ****
+! b
+ a
+--- 1,2 ----
+! a
+ a
diff --git a/patch-test/18/patch-e b/patch-test/18/patch-e
new file mode 100644
index 0000000..aa58a88
--- /dev/null
+++ b/patch-test/18/patch-e
@@ -0,0 +1,3 @@
+1c
+a
+.
diff --git a/patch-test/18/patch-u b/patch-test/18/patch-u
new file mode 100644
index 0000000..463aeb3
--- /dev/null
+++ b/patch-test/18/patch-u
@@ -0,0 +1,8 @@
+--- old 2016-03-11 09:40:47.945405710 +0100
++++ new 2016-03-11 09:40:47.945405710 +0100
+@@ -1,4 +1,4 @@
+-b
++a
+ a
+ a
+ a
diff --git a/patch-test/18/patch-u0 b/patch-test/18/patch-u0
new file mode 100644
index 0000000..04f93e5
--- /dev/null
+++ b/patch-test/18/patch-u0
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:40:47.945405710 +0100
++++ new 2016-03-11 09:40:47.945405710 +0100
+@@ -1 +1 @@
+-b
++a
diff --git a/patch-test/18/patch-u1 b/patch-test/18/patch-u1
new file mode 100644
index 0000000..c4f12fb
--- /dev/null
+++ b/patch-test/18/patch-u1
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:40:47.945405710 +0100
++++ new 2016-03-11 09:40:47.945405710 +0100
+@@ -1,2 +1,2 @@
+-b
++a
+ a
diff --git a/patch-test/19/def b/patch-test/19/def
new file mode 100644
index 0000000..0c45f07
--- /dev/null
+++ b/patch-test/19/def
@@ -0,0 +1,14 @@
+a
+a
+a
+a
+a
+#ifndef x
+b
+#else
+a
+#endif
+a
+a
+a
+a
diff --git a/patch-test/19/new b/patch-test/19/new
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/19/new
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/19/old b/patch-test/19/old
new file mode 100644
index 0000000..a0a47f0
--- /dev/null
+++ b/patch-test/19/old
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+b
+a
+a
+a
+a
diff --git a/patch-test/19/patch b/patch-test/19/patch
new file mode 100644
index 0000000..929fe91
--- /dev/null
+++ b/patch-test/19/patch
@@ -0,0 +1,4 @@
+6c6
+< b
+---
+> a
diff --git a/patch-test/19/patch-c b/patch-test/19/patch-c
new file mode 100644
index 0000000..7969876
--- /dev/null
+++ b/patch-test/19/patch-c
@@ -0,0 +1,19 @@
+*** old 2016-03-11 09:40:53.818741289 +0100
+--- new 2016-03-11 09:40:53.818741289 +0100
+***************
+*** 3,9 ****
+ a
+ a
+ a
+! b
+ a
+ a
+ a
+--- 3,9 ----
+ a
+ a
+ a
+! a
+ a
+ a
+ a
diff --git a/patch-test/19/patch-c0 b/patch-test/19/patch-c0
new file mode 100644
index 0000000..64f7eaa
--- /dev/null
+++ b/patch-test/19/patch-c0
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:40:53.818741289 +0100
+--- new 2016-03-11 09:40:53.818741289 +0100
+***************
+*** 6 ****
+! b
+--- 6 ----
+! a
diff --git a/patch-test/19/patch-c1 b/patch-test/19/patch-c1
new file mode 100644
index 0000000..3730cb7
--- /dev/null
+++ b/patch-test/19/patch-c1
@@ -0,0 +1,11 @@
+*** old 2016-03-11 09:40:53.818741289 +0100
+--- new 2016-03-11 09:40:53.818741289 +0100
+***************
+*** 5,7 ****
+ a
+! b
+ a
+--- 5,7 ----
+ a
+! a
+ a
diff --git a/patch-test/19/patch-e b/patch-test/19/patch-e
new file mode 100644
index 0000000..8a04d00
--- /dev/null
+++ b/patch-test/19/patch-e
@@ -0,0 +1,3 @@
+6c
+a
+.
diff --git a/patch-test/19/patch-u b/patch-test/19/patch-u
new file mode 100644
index 0000000..bf34497
--- /dev/null
+++ b/patch-test/19/patch-u
@@ -0,0 +1,11 @@
+--- old 2016-03-11 09:40:53.818741289 +0100
++++ new 2016-03-11 09:40:53.818741289 +0100
+@@ -3,7 +3,7 @@
+ a
+ a
+ a
+-b
++a
+ a
+ a
+ a
diff --git a/patch-test/19/patch-u0 b/patch-test/19/patch-u0
new file mode 100644
index 0000000..051acfa
--- /dev/null
+++ b/patch-test/19/patch-u0
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:40:53.818741289 +0100
++++ new 2016-03-11 09:40:53.818741289 +0100
+@@ -6 +6 @@
+-b
++a
diff --git a/patch-test/19/patch-u1 b/patch-test/19/patch-u1
new file mode 100644
index 0000000..3919f5e
--- /dev/null
+++ b/patch-test/19/patch-u1
@@ -0,0 +1,7 @@
+--- old 2016-03-11 09:40:53.818741289 +0100
++++ new 2016-03-11 09:40:53.818741289 +0100
+@@ -5,3 +5,3 @@
+ a
+-b
++a
+ a
diff --git a/patch-test/2/def b/patch-test/2/def
new file mode 100644
index 0000000..7c5bac5
--- /dev/null
+++ b/patch-test/2/def
@@ -0,0 +1,5 @@
+#ifndef x
+hi
+#else
+hej
+#endif
diff --git a/patch-test/2/new b/patch-test/2/new
new file mode 100644
index 0000000..eca14b8
--- /dev/null
+++ b/patch-test/2/new
@@ -0,0 +1 @@
+hej \ No newline at end of file
diff --git a/patch-test/2/old b/patch-test/2/old
new file mode 100644
index 0000000..32f95c0
--- /dev/null
+++ b/patch-test/2/old
@@ -0,0 +1 @@
+hi \ No newline at end of file
diff --git a/patch-test/2/patch b/patch-test/2/patch
new file mode 100644
index 0000000..e65f505
--- /dev/null
+++ b/patch-test/2/patch
@@ -0,0 +1,6 @@
+1c1
+< hi
+\ No newline at end of file
+---
+> hej
+\ No newline at end of file
diff --git a/patch-test/2/patch-c b/patch-test/2/patch-c
new file mode 100644
index 0000000..59a6c21
--- /dev/null
+++ b/patch-test/2/patch-c
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:30:55.118512465 +0100
+--- new 2016-03-11 09:30:55.145179141 +0100
+***************
+*** 1 ****
+! hi
+\ No newline at end of file
+--- 1 ----
+! hej
+\ No newline at end of file
diff --git a/patch-test/2/patch-c0 b/patch-test/2/patch-c0
new file mode 100644
index 0000000..59a6c21
--- /dev/null
+++ b/patch-test/2/patch-c0
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:30:55.118512465 +0100
+--- new 2016-03-11 09:30:55.145179141 +0100
+***************
+*** 1 ****
+! hi
+\ No newline at end of file
+--- 1 ----
+! hej
+\ No newline at end of file
diff --git a/patch-test/2/patch-c1 b/patch-test/2/patch-c1
new file mode 100644
index 0000000..59a6c21
--- /dev/null
+++ b/patch-test/2/patch-c1
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:30:55.118512465 +0100
+--- new 2016-03-11 09:30:55.145179141 +0100
+***************
+*** 1 ****
+! hi
+\ No newline at end of file
+--- 1 ----
+! hej
+\ No newline at end of file
diff --git a/patch-test/2/patch-u b/patch-test/2/patch-u
new file mode 100644
index 0000000..a576cad
--- /dev/null
+++ b/patch-test/2/patch-u
@@ -0,0 +1,7 @@
+--- old 2016-03-11 09:30:55.118512465 +0100
++++ new 2016-03-11 09:30:55.145179141 +0100
+@@ -1 +1 @@
+-hi
+\ No newline at end of file
++hej
+\ No newline at end of file
diff --git a/patch-test/2/patch-u0 b/patch-test/2/patch-u0
new file mode 100644
index 0000000..a576cad
--- /dev/null
+++ b/patch-test/2/patch-u0
@@ -0,0 +1,7 @@
+--- old 2016-03-11 09:30:55.118512465 +0100
++++ new 2016-03-11 09:30:55.145179141 +0100
+@@ -1 +1 @@
+-hi
+\ No newline at end of file
++hej
+\ No newline at end of file
diff --git a/patch-test/2/patch-u1 b/patch-test/2/patch-u1
new file mode 100644
index 0000000..a576cad
--- /dev/null
+++ b/patch-test/2/patch-u1
@@ -0,0 +1,7 @@
+--- old 2016-03-11 09:30:55.118512465 +0100
++++ new 2016-03-11 09:30:55.145179141 +0100
+@@ -1 +1 @@
+-hi
+\ No newline at end of file
++hej
+\ No newline at end of file
diff --git a/patch-test/20/def b/patch-test/20/def
new file mode 100644
index 0000000..06ea3d9
--- /dev/null
+++ b/patch-test/20/def
@@ -0,0 +1,14 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+#ifndef x
+b
+#else
+a
+#endif
diff --git a/patch-test/20/new b/patch-test/20/new
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/20/new
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/20/old b/patch-test/20/old
new file mode 100644
index 0000000..105ab99
--- /dev/null
+++ b/patch-test/20/old
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+b
diff --git a/patch-test/20/patch b/patch-test/20/patch
new file mode 100644
index 0000000..69aa3ac
--- /dev/null
+++ b/patch-test/20/patch
@@ -0,0 +1,4 @@
+10c10
+< b
+---
+> a
diff --git a/patch-test/20/patch-c b/patch-test/20/patch-c
new file mode 100644
index 0000000..9e7f3b8
--- /dev/null
+++ b/patch-test/20/patch-c
@@ -0,0 +1,13 @@
+*** old 2016-03-11 09:40:55.785408703 +0100
+--- new 2016-03-11 09:40:55.785408703 +0100
+***************
+*** 7,10 ****
+ a
+ a
+ a
+! b
+--- 7,10 ----
+ a
+ a
+ a
+! a
diff --git a/patch-test/20/patch-c0 b/patch-test/20/patch-c0
new file mode 100644
index 0000000..3a2b257
--- /dev/null
+++ b/patch-test/20/patch-c0
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:40:55.785408703 +0100
+--- new 2016-03-11 09:40:55.785408703 +0100
+***************
+*** 10 ****
+! b
+--- 10 ----
+! a
diff --git a/patch-test/20/patch-c1 b/patch-test/20/patch-c1
new file mode 100644
index 0000000..051352a
--- /dev/null
+++ b/patch-test/20/patch-c1
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:40:55.785408703 +0100
+--- new 2016-03-11 09:40:55.785408703 +0100
+***************
+*** 9,10 ****
+ a
+! b
+--- 9,10 ----
+ a
+! a
diff --git a/patch-test/20/patch-e b/patch-test/20/patch-e
new file mode 100644
index 0000000..20bdc89
--- /dev/null
+++ b/patch-test/20/patch-e
@@ -0,0 +1,3 @@
+10c
+a
+.
diff --git a/patch-test/20/patch-u b/patch-test/20/patch-u
new file mode 100644
index 0000000..b466532
--- /dev/null
+++ b/patch-test/20/patch-u
@@ -0,0 +1,8 @@
+--- old 2016-03-11 09:40:55.785408703 +0100
++++ new 2016-03-11 09:40:55.785408703 +0100
+@@ -7,4 +7,4 @@
+ a
+ a
+ a
+-b
++a
diff --git a/patch-test/20/patch-u0 b/patch-test/20/patch-u0
new file mode 100644
index 0000000..665e7a6
--- /dev/null
+++ b/patch-test/20/patch-u0
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:40:55.785408703 +0100
++++ new 2016-03-11 09:40:55.785408703 +0100
+@@ -10 +10 @@
+-b
++a
diff --git a/patch-test/20/patch-u1 b/patch-test/20/patch-u1
new file mode 100644
index 0000000..efd3c30
--- /dev/null
+++ b/patch-test/20/patch-u1
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:40:55.785408703 +0100
++++ new 2016-03-11 09:40:55.785408703 +0100
+@@ -9,2 +9,2 @@
+ a
+-b
++a
diff --git a/patch-test/21/def b/patch-test/21/def
new file mode 100644
index 0000000..76ed4ab
--- /dev/null
+++ b/patch-test/21/def
@@ -0,0 +1,48 @@
+#ifdef x
+b
+#endif
+a
+a
+a
+a
+a
+a
+a
+a
+#ifdef x
+b
+#endif
+a
+a
+a
+a
+a
+a
+a
+#ifndef x
+c
+#endif
+a
+a
+a
+a
+a
+a
+a
+#ifdef x
+b
+#endif
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+#ifdef x
+b
+#endif
diff --git a/patch-test/21/new b/patch-test/21/new
new file mode 100644
index 0000000..9dc0f5b
--- /dev/null
+++ b/patch-test/21/new
@@ -0,0 +1,37 @@
+b
+a
+a
+a
+a
+a
+a
+a
+a
+b
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+b
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+b
diff --git a/patch-test/21/old b/patch-test/21/old
new file mode 100644
index 0000000..6109918
--- /dev/null
+++ b/patch-test/21/old
@@ -0,0 +1,34 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+c
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/21/patch b/patch-test/21/patch
new file mode 100644
index 0000000..9a8d9bf
--- /dev/null
+++ b/patch-test/21/patch
@@ -0,0 +1,10 @@
+0a1
+> b
+8a10
+> b
+16d17
+< c
+23a25
+> b
+34a37
+> b
diff --git a/patch-test/21/patch-c b/patch-test/21/patch-c
new file mode 100644
index 0000000..47f20e4
--- /dev/null
+++ b/patch-test/21/patch-c
@@ -0,0 +1,46 @@
+*** old 2016-03-18 11:25:10.615650099 +0100
+--- new 2016-03-18 11:25:10.335650001 +0100
+***************
+*** 1,3 ****
+--- 1,4 ----
++ b
+ a
+ a
+ a
+***************
+*** 6,11 ****
+--- 7,13 ----
+ a
+ a
+ a
++ b
+ a
+ a
+ a
+***************
+*** 13,19 ****
+ a
+ a
+ a
+- c
+ a
+ a
+ a
+--- 15,20 ----
+***************
+*** 21,26 ****
+--- 22,28 ----
+ a
+ a
+ a
++ b
+ a
+ a
+ a
+***************
+*** 32,34 ****
+--- 34,37 ----
+ a
+ a
+ a
++ b
diff --git a/patch-test/21/patch-c0 b/patch-test/21/patch-c0
new file mode 100644
index 0000000..4082af6
--- /dev/null
+++ b/patch-test/21/patch-c0
@@ -0,0 +1,22 @@
+*** old 2016-03-18 11:25:10.615650099 +0100
+--- new 2016-03-18 11:25:10.335650001 +0100
+***************
+*** 0 ****
+--- 1 ----
++ b
+***************
+*** 8 ****
+--- 10 ----
++ b
+***************
+*** 16 ****
+- c
+--- 17 ----
+***************
+*** 23 ****
+--- 25 ----
++ b
+***************
+*** 34 ****
+--- 37 ----
++ b
diff --git a/patch-test/21/patch-c1 b/patch-test/21/patch-c1
new file mode 100644
index 0000000..bf7cec5
--- /dev/null
+++ b/patch-test/21/patch-c1
@@ -0,0 +1,30 @@
+*** old 2016-03-18 11:25:10.615650099 +0100
+--- new 2016-03-18 11:25:10.335650001 +0100
+***************
+*** 1 ****
+--- 1,2 ----
++ b
+ a
+***************
+*** 8,9 ****
+--- 9,11 ----
+ a
++ b
+ a
+***************
+*** 15,17 ****
+ a
+- c
+ a
+--- 17,18 ----
+***************
+*** 23,24 ****
+--- 24,26 ----
+ a
++ b
+ a
+***************
+*** 34 ****
+--- 36,37 ----
+ a
++ b
diff --git a/patch-test/21/patch-e b/patch-test/21/patch-e
new file mode 100644
index 0000000..f523a87
--- /dev/null
+++ b/patch-test/21/patch-e
@@ -0,0 +1,13 @@
+34a
+b
+.
+23a
+b
+.
+16d
+8a
+b
+.
+0a
+b
+.
diff --git a/patch-test/21/patch-u b/patch-test/21/patch-u
new file mode 100644
index 0000000..031231d
--- /dev/null
+++ b/patch-test/21/patch-u
@@ -0,0 +1,36 @@
+--- old 2016-03-18 11:25:10.615650099 +0100
++++ new 2016-03-18 11:25:10.335650001 +0100
+@@ -1,3 +1,4 @@
++b
+ a
+ a
+ a
+@@ -6,6 +7,7 @@
+ a
+ a
+ a
++b
+ a
+ a
+ a
+@@ -13,7 +15,6 @@
+ a
+ a
+ a
+-c
+ a
+ a
+ a
+@@ -21,6 +22,7 @@
+ a
+ a
+ a
++b
+ a
+ a
+ a
+@@ -32,3 +34,4 @@
+ a
+ a
+ a
++b
diff --git a/patch-test/21/patch-u0 b/patch-test/21/patch-u0
new file mode 100644
index 0000000..a1bdf1a
--- /dev/null
+++ b/patch-test/21/patch-u0
@@ -0,0 +1,12 @@
+--- old 2016-03-18 11:25:10.615650099 +0100
++++ new 2016-03-18 11:25:10.335650001 +0100
+@@ -0,0 +1 @@
++b
+@@ -8,0 +10 @@
++b
+@@ -16 +17,0 @@
+-c
+@@ -23,0 +25 @@
++b
+@@ -34,0 +37 @@
++b
diff --git a/patch-test/21/patch-u1 b/patch-test/21/patch-u1
new file mode 100644
index 0000000..6730858
--- /dev/null
+++ b/patch-test/21/patch-u1
@@ -0,0 +1,20 @@
+--- old 2016-03-18 11:25:10.615650099 +0100
++++ new 2016-03-18 11:25:10.335650001 +0100
+@@ -1 +1,2 @@
++b
+ a
+@@ -8,2 +9,3 @@
+ a
++b
+ a
+@@ -15,3 +17,2 @@
+ a
+-c
+ a
+@@ -23,2 +24,3 @@
+ a
++b
+ a
+@@ -34 +36,2 @@
+ a
++b
diff --git a/patch-test/22/def b/patch-test/22/def
new file mode 100644
index 0000000..20bf4e5
--- /dev/null
+++ b/patch-test/22/def
@@ -0,0 +1,48 @@
+#ifndef x
+b
+#endif
+a
+a
+a
+a
+a
+a
+a
+a
+#ifndef x
+b
+#endif
+a
+a
+a
+a
+a
+a
+a
+#ifdef x
+c
+#endif
+a
+a
+a
+a
+a
+a
+a
+#ifndef x
+b
+#endif
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+#ifndef x
+b
+#endif
diff --git a/patch-test/22/new b/patch-test/22/new
new file mode 100644
index 0000000..6109918
--- /dev/null
+++ b/patch-test/22/new
@@ -0,0 +1,34 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+c
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/22/old b/patch-test/22/old
new file mode 100644
index 0000000..9dc0f5b
--- /dev/null
+++ b/patch-test/22/old
@@ -0,0 +1,37 @@
+b
+a
+a
+a
+a
+a
+a
+a
+a
+b
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+b
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+b
diff --git a/patch-test/22/patch b/patch-test/22/patch
new file mode 100644
index 0000000..621729a
--- /dev/null
+++ b/patch-test/22/patch
@@ -0,0 +1,10 @@
+1d0
+< b
+10d8
+< b
+17a16
+> c
+25d23
+< b
+37d34
+< b
diff --git a/patch-test/22/patch-c b/patch-test/22/patch-c
new file mode 100644
index 0000000..d12bbd8
--- /dev/null
+++ b/patch-test/22/patch-c
@@ -0,0 +1,46 @@
+*** old 2016-03-18 11:26:29.745677358 +0100
+--- new 2016-03-18 11:26:24.632342265 +0100
+***************
+*** 1,4 ****
+- b
+ a
+ a
+ a
+--- 1,3 ----
+***************
+*** 7,13 ****
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+--- 6,11 ----
+***************
+*** 15,20 ****
+--- 13,19 ----
+ a
+ a
+ a
++ c
+ a
+ a
+ a
+***************
+*** 22,28 ****
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+--- 21,26 ----
+***************
+*** 34,37 ****
+ a
+ a
+ a
+- b
+--- 32,34 ----
diff --git a/patch-test/22/patch-c0 b/patch-test/22/patch-c0
new file mode 100644
index 0000000..c928a10
--- /dev/null
+++ b/patch-test/22/patch-c0
@@ -0,0 +1,22 @@
+*** old 2016-03-18 11:26:29.745677358 +0100
+--- new 2016-03-18 11:26:24.632342265 +0100
+***************
+*** 1 ****
+- b
+--- 0 ----
+***************
+*** 10 ****
+- b
+--- 8 ----
+***************
+*** 17 ****
+--- 16 ----
++ c
+***************
+*** 25 ****
+- b
+--- 23 ----
+***************
+*** 37 ****
+- b
+--- 34 ----
diff --git a/patch-test/22/patch-c1 b/patch-test/22/patch-c1
new file mode 100644
index 0000000..5a579c0
--- /dev/null
+++ b/patch-test/22/patch-c1
@@ -0,0 +1,30 @@
+*** old 2016-03-18 11:26:29.745677358 +0100
+--- new 2016-03-18 11:26:24.632342265 +0100
+***************
+*** 1,2 ****
+- b
+ a
+--- 1 ----
+***************
+*** 9,11 ****
+ a
+- b
+ a
+--- 8,9 ----
+***************
+*** 17,18 ****
+--- 15,17 ----
+ a
++ c
+ a
+***************
+*** 24,26 ****
+ a
+- b
+ a
+--- 23,24 ----
+***************
+*** 36,37 ****
+ a
+- b
+--- 34 ----
diff --git a/patch-test/22/patch-e b/patch-test/22/patch-e
new file mode 100644
index 0000000..66f6b3d
--- /dev/null
+++ b/patch-test/22/patch-e
@@ -0,0 +1,7 @@
+37d
+25d
+17a
+c
+.
+10d
+1d
diff --git a/patch-test/22/patch-u b/patch-test/22/patch-u
new file mode 100644
index 0000000..8289596
--- /dev/null
+++ b/patch-test/22/patch-u
@@ -0,0 +1,36 @@
+--- old 2016-03-18 11:26:29.745677358 +0100
++++ new 2016-03-18 11:26:24.632342265 +0100
+@@ -1,4 +1,3 @@
+-b
+ a
+ a
+ a
+@@ -7,7 +6,6 @@
+ a
+ a
+ a
+-b
+ a
+ a
+ a
+@@ -15,6 +13,7 @@
+ a
+ a
+ a
++c
+ a
+ a
+ a
+@@ -22,7 +21,6 @@
+ a
+ a
+ a
+-b
+ a
+ a
+ a
+@@ -34,4 +32,3 @@
+ a
+ a
+ a
+-b
diff --git a/patch-test/22/patch-u0 b/patch-test/22/patch-u0
new file mode 100644
index 0000000..ba25757
--- /dev/null
+++ b/patch-test/22/patch-u0
@@ -0,0 +1,12 @@
+--- old 2016-03-18 11:26:29.745677358 +0100
++++ new 2016-03-18 11:26:24.632342265 +0100
+@@ -1 +0,0 @@
+-b
+@@ -10 +8,0 @@
+-b
+@@ -17,0 +16 @@
++c
+@@ -25 +23,0 @@
+-b
+@@ -37 +34,0 @@
+-b
diff --git a/patch-test/22/patch-u1 b/patch-test/22/patch-u1
new file mode 100644
index 0000000..f8821fe
--- /dev/null
+++ b/patch-test/22/patch-u1
@@ -0,0 +1,20 @@
+--- old 2016-03-18 11:26:29.745677358 +0100
++++ new 2016-03-18 11:26:24.632342265 +0100
+@@ -1,2 +1 @@
+-b
+ a
+@@ -9,3 +8,2 @@
+ a
+-b
+ a
+@@ -17,2 +15,3 @@
+ a
++c
+ a
+@@ -24,3 +23,2 @@
+ a
+-b
+ a
+@@ -36,2 +34 @@
+ a
+-b
diff --git a/patch-test/23/def b/patch-test/23/def
new file mode 100644
index 0000000..a87621c
--- /dev/null
+++ b/patch-test/23/def
@@ -0,0 +1,41 @@
+#ifndef x
+bb
+#else
+BB
+#endif
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+#ifndef x
+bb
+bb
+#else
+BB
+BB
+#endif
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+#ifndef x
+bb
+bb
+bb
+#else
+BB
+BB
+BB
+#endif
diff --git a/patch-test/23/new b/patch-test/23/new
new file mode 100644
index 0000000..a166d7e
--- /dev/null
+++ b/patch-test/23/new
@@ -0,0 +1,26 @@
+BB
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+BB
+BB
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+BB
+BB
+BB
diff --git a/patch-test/23/old b/patch-test/23/old
new file mode 100644
index 0000000..7fbb969
--- /dev/null
+++ b/patch-test/23/old
@@ -0,0 +1,26 @@
+bb
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+bb
+bb
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
+bb
+bb
+bb
diff --git a/patch-test/23/patch b/patch-test/23/patch
new file mode 100644
index 0000000..692d027
--- /dev/null
+++ b/patch-test/23/patch
@@ -0,0 +1,18 @@
+1c1
+< bb
+---
+> BB
+12,13c12,13
+< bb
+< bb
+---
+> BB
+> BB
+24,26c24,26
+< bb
+< bb
+< bb
+---
+> BB
+> BB
+> BB
diff --git a/patch-test/23/patch-c b/patch-test/23/patch-c
new file mode 100644
index 0000000..b6bb929
--- /dev/null
+++ b/patch-test/23/patch-c
@@ -0,0 +1,47 @@
+*** old 2016-03-18 12:52:55.560874801 +0100
+--- new 2016-03-18 12:52:42.227536660 +0100
+***************
+*** 1,4 ****
+! bb
+ a
+ a
+ a
+--- 1,4 ----
+! BB
+ a
+ a
+ a
+***************
+*** 9,16 ****
+ a
+ a
+ a
+! bb
+! bb
+ a
+ a
+ a
+--- 9,16 ----
+ a
+ a
+ a
+! BB
+! BB
+ a
+ a
+ a
+***************
+*** 21,26 ****
+ a
+ a
+ a
+! bb
+! bb
+! bb
+--- 21,26 ----
+ a
+ a
+ a
+! BB
+! BB
+! BB
diff --git a/patch-test/23/patch-c0 b/patch-test/23/patch-c0
new file mode 100644
index 0000000..173bb26
--- /dev/null
+++ b/patch-test/23/patch-c0
@@ -0,0 +1,23 @@
+*** old 2016-03-18 12:52:55.560874801 +0100
+--- new 2016-03-18 12:52:42.227536660 +0100
+***************
+*** 1 ****
+! bb
+--- 1 ----
+! BB
+***************
+*** 12,13 ****
+! bb
+! bb
+--- 12,13 ----
+! BB
+! BB
+***************
+*** 24,26 ****
+! bb
+! bb
+! bb
+--- 24,26 ----
+! BB
+! BB
+! BB
diff --git a/patch-test/23/patch-c1 b/patch-test/23/patch-c1
new file mode 100644
index 0000000..6b5f1c9
--- /dev/null
+++ b/patch-test/23/patch-c1
@@ -0,0 +1,31 @@
+*** old 2016-03-18 12:52:55.560874801 +0100
+--- new 2016-03-18 12:52:42.227536660 +0100
+***************
+*** 1,2 ****
+! bb
+ a
+--- 1,2 ----
+! BB
+ a
+***************
+*** 11,14 ****
+ a
+! bb
+! bb
+ a
+--- 11,14 ----
+ a
+! BB
+! BB
+ a
+***************
+*** 23,26 ****
+ a
+! bb
+! bb
+! bb
+--- 23,26 ----
+ a
+! BB
+! BB
+! BB
diff --git a/patch-test/23/patch-e b/patch-test/23/patch-e
new file mode 100644
index 0000000..278cd37
--- /dev/null
+++ b/patch-test/23/patch-e
@@ -0,0 +1,12 @@
+24,26c
+BB
+BB
+BB
+.
+12,13c
+BB
+BB
+.
+1c
+BB
+.
diff --git a/patch-test/23/patch-u b/patch-test/23/patch-u
new file mode 100644
index 0000000..e747046
--- /dev/null
+++ b/patch-test/23/patch-u
@@ -0,0 +1,29 @@
+--- old 2016-03-18 12:52:55.560874801 +0100
++++ new 2016-03-18 12:52:42.227536660 +0100
+@@ -1,4 +1,4 @@
+-bb
++BB
+ a
+ a
+ a
+@@ -9,8 +9,8 @@
+ a
+ a
+ a
+-bb
+-bb
++BB
++BB
+ a
+ a
+ a
+@@ -21,6 +21,6 @@
+ a
+ a
+ a
+-bb
+-bb
+-bb
++BB
++BB
++BB
diff --git a/patch-test/23/patch-u0 b/patch-test/23/patch-u0
new file mode 100644
index 0000000..eda588e
--- /dev/null
+++ b/patch-test/23/patch-u0
@@ -0,0 +1,17 @@
+--- old 2016-03-18 12:52:55.560874801 +0100
++++ new 2016-03-18 12:52:42.227536660 +0100
+@@ -1 +1 @@
+-bb
++BB
+@@ -12,2 +12,2 @@
+-bb
+-bb
++BB
++BB
+@@ -24,3 +24,3 @@
+-bb
+-bb
+-bb
++BB
++BB
++BB
diff --git a/patch-test/23/patch-u1 b/patch-test/23/patch-u1
new file mode 100644
index 0000000..f3dadae
--- /dev/null
+++ b/patch-test/23/patch-u1
@@ -0,0 +1,21 @@
+--- old 2016-03-18 12:52:55.560874801 +0100
++++ new 2016-03-18 12:52:42.227536660 +0100
+@@ -1,2 +1,2 @@
+-bb
++BB
+ a
+@@ -11,4 +11,4 @@
+ a
+-bb
+-bb
++BB
++BB
+ a
+@@ -23,4 +23,4 @@
+ a
+-bb
+-bb
+-bb
++BB
++BB
++BB
diff --git a/patch-test/24/def b/patch-test/24/def
new file mode 100644
index 0000000..89ef082
--- /dev/null
+++ b/patch-test/24/def
Binary files differ
diff --git a/patch-test/24/new b/patch-test/24/new
new file mode 100644
index 0000000..fa25830
--- /dev/null
+++ b/patch-test/24/new
Binary files differ
diff --git a/patch-test/24/old b/patch-test/24/old
new file mode 100644
index 0000000..1189f81
--- /dev/null
+++ b/patch-test/24/old
Binary files differ
diff --git a/patch-test/24/patch b/patch-test/24/patch
new file mode 100644
index 0000000..0c041b8
--- /dev/null
+++ b/patch-test/24/patch
Binary files differ
diff --git a/patch-test/24/patch-c b/patch-test/24/patch-c
new file mode 100644
index 0000000..55211ef
--- /dev/null
+++ b/patch-test/24/patch-c
Binary files differ
diff --git a/patch-test/24/patch-c0 b/patch-test/24/patch-c0
new file mode 100644
index 0000000..249ff38
--- /dev/null
+++ b/patch-test/24/patch-c0
Binary files differ
diff --git a/patch-test/24/patch-c1 b/patch-test/24/patch-c1
new file mode 100644
index 0000000..393bf63
--- /dev/null
+++ b/patch-test/24/patch-c1
Binary files differ
diff --git a/patch-test/24/patch-u b/patch-test/24/patch-u
new file mode 100644
index 0000000..520f4af
--- /dev/null
+++ b/patch-test/24/patch-u
Binary files differ
diff --git a/patch-test/24/patch-u0 b/patch-test/24/patch-u0
new file mode 100644
index 0000000..b1d22cb
--- /dev/null
+++ b/patch-test/24/patch-u0
Binary files differ
diff --git a/patch-test/24/patch-u1 b/patch-test/24/patch-u1
new file mode 100644
index 0000000..6d23146
--- /dev/null
+++ b/patch-test/24/patch-u1
Binary files differ
diff --git a/patch-test/25/def b/patch-test/25/def
new file mode 100644
index 0000000..e918fee
--- /dev/null
+++ b/patch-test/25/def
@@ -0,0 +1,51 @@
+static int
+main(void) {
+#ifndef x
+ b
+#endif
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+#ifndef x
+ b
+#endif
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+#ifdef x
+ c
+#endif
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+#ifndef x
+ b
+#endif
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+#ifndef x
+ b
+#endif
+}
diff --git a/patch-test/25/new b/patch-test/25/new
new file mode 100644
index 0000000..50269fa
--- /dev/null
+++ b/patch-test/25/new
@@ -0,0 +1,37 @@
+static int
+main(void) {
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ c
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+}
diff --git a/patch-test/25/old b/patch-test/25/old
new file mode 100644
index 0000000..62f7608
--- /dev/null
+++ b/patch-test/25/old
@@ -0,0 +1,40 @@
+static int
+main(void) {
+ b
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ b
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ b
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ b
+}
diff --git a/patch-test/25/patch-c b/patch-test/25/patch-c
new file mode 100644
index 0000000..cbe6207
--- /dev/null
+++ b/patch-test/25/patch-c
@@ -0,0 +1,49 @@
+*** old 2016-03-18 23:19:33.246770663 +0100
+--- new 2016-03-18 23:19:19.333432768 +0100
+***************
+*** 1,6 ****
+ static int
+ main(void) {
+- b
+ a
+ a
+ a
+--- 1,5 ----
+*************** main(void) {
+*** 9,15 ****
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+--- 8,13 ----
+*************** main(void) {
+*** 17,22 ****
+--- 15,21 ----
+ a
+ a
+ a
++ c
+ a
+ a
+ a
+*************** main(void) {
+*** 24,30 ****
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+--- 23,28 ----
+*************** main(void) {
+*** 36,40 ****
+ a
+ a
+ a
+- b
+ }
+--- 34,37 ----
diff --git a/patch-test/25/patch-c0 b/patch-test/25/patch-c0
new file mode 100644
index 0000000..699048b
--- /dev/null
+++ b/patch-test/25/patch-c0
@@ -0,0 +1,22 @@
+*** old 2016-03-18 23:19:33.246770663 +0100
+--- new 2016-03-18 23:19:19.333432768 +0100
+*************** main(void) {
+*** 3 ****
+- b
+--- 2 ----
+*************** main(void) {
+*** 12 ****
+- b
+--- 10 ----
+*************** main(void) {
+*** 19 ****
+--- 18 ----
++ c
+*************** main(void) {
+*** 27 ****
+- b
+--- 25 ----
+*************** main(void) {
+*** 39 ****
+- b
+--- 36 ----
diff --git a/patch-test/25/patch-c1 b/patch-test/25/patch-c1
new file mode 100644
index 0000000..522a50e
--- /dev/null
+++ b/patch-test/25/patch-c1
@@ -0,0 +1,32 @@
+*** old 2016-03-18 23:19:33.246770663 +0100
+--- new 2016-03-18 23:19:19.333432768 +0100
+*************** static int
+*** 2,4 ****
+ main(void) {
+- b
+ a
+--- 2,3 ----
+*************** main(void) {
+*** 11,13 ****
+ a
+- b
+ a
+--- 10,11 ----
+*************** main(void) {
+*** 19,20 ****
+--- 17,19 ----
+ a
++ c
+ a
+*************** main(void) {
+*** 26,28 ****
+ a
+- b
+ a
+--- 25,26 ----
+*************** main(void) {
+*** 38,40 ****
+ a
+- b
+ }
+--- 36,37 ----
diff --git a/patch-test/25/patch-e b/patch-test/25/patch-e
new file mode 100644
index 0000000..5d862ff
--- /dev/null
+++ b/patch-test/25/patch-e
@@ -0,0 +1,7 @@
+39d
+27d
+19a
+ c
+.
+12d
+3d
diff --git a/patch-test/25/patch-u b/patch-test/25/patch-u
new file mode 100644
index 0000000..b15ff46
--- /dev/null
+++ b/patch-test/25/patch-u
@@ -0,0 +1,39 @@
+--- old 2016-03-18 23:19:33.246770663 +0100
++++ new 2016-03-18 23:19:19.333432768 +0100
+@@ -1,6 +1,5 @@
+ static int
+ main(void) {
+- b
+ a
+ a
+ a
+@@ -9,7 +8,6 @@ main(void) {
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+@@ -17,6 +15,7 @@ main(void) {
+ a
+ a
+ a
++ c
+ a
+ a
+ a
+@@ -24,7 +23,6 @@ main(void) {
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+@@ -36,5 +34,4 @@ main(void) {
+ a
+ a
+ a
+- b
+ }
diff --git a/patch-test/25/patch-u0 b/patch-test/25/patch-u0
new file mode 100644
index 0000000..d604b79
--- /dev/null
+++ b/patch-test/25/patch-u0
@@ -0,0 +1,12 @@
+--- old 2016-03-18 23:19:33.246770663 +0100
++++ new 2016-03-18 23:19:19.333432768 +0100
+@@ -3 +2,0 @@ main(void) {
+- b
+@@ -12 +10,0 @@ main(void) {
+- b
+@@ -19,0 +18 @@ main(void) {
++ c
+@@ -27 +25,0 @@ main(void) {
+- b
+@@ -39 +36,0 @@ main(void) {
+- b
diff --git a/patch-test/25/patch-u1 b/patch-test/25/patch-u1
new file mode 100644
index 0000000..2b7c5ed
--- /dev/null
+++ b/patch-test/25/patch-u1
@@ -0,0 +1,22 @@
+--- old 2016-03-18 23:19:33.246770663 +0100
++++ new 2016-03-18 23:19:19.333432768 +0100
+@@ -2,3 +2,2 @@ static int
+ main(void) {
+- b
+ a
+@@ -11,3 +10,2 @@ main(void) {
+ a
+- b
+ a
+@@ -19,2 +17,3 @@ main(void) {
+ a
++ c
+ a
+@@ -26,3 +25,2 @@ main(void) {
+ a
+- b
+ a
+@@ -38,3 +36,2 @@ main(void) {
+ a
+- b
+ }
diff --git a/patch-test/26/def b/patch-test/26/def
new file mode 100644
index 0000000..936c257
--- /dev/null
+++ b/patch-test/26/def
@@ -0,0 +1,54 @@
+#ifndef x
+int
+main(void) {
+ b
+#else
+void
+kmain(void) {
+#endif
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+#ifndef x
+ b
+#endif
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+#ifdef x
+ c
+#endif
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+#ifndef x
+ b
+#endif
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+#ifndef x
+ b
+#endif
+}
diff --git a/patch-test/26/new b/patch-test/26/new
new file mode 100644
index 0000000..686b6a1
--- /dev/null
+++ b/patch-test/26/new
@@ -0,0 +1,37 @@
+void
+kmain(void) {
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ c
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+}
diff --git a/patch-test/26/old b/patch-test/26/old
new file mode 100644
index 0000000..2bf508e
--- /dev/null
+++ b/patch-test/26/old
@@ -0,0 +1,40 @@
+int
+main(void) {
+ b
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ b
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ b
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ b
+}
diff --git a/patch-test/26/patch-c b/patch-test/26/patch-c
new file mode 100644
index 0000000..ddf8538
--- /dev/null
+++ b/patch-test/26/patch-c
@@ -0,0 +1,54 @@
+*** old 2016-03-18 23:20:46.950128155 +0100
+--- new 2016-03-18 23:20:45.210127585 +0100
+***************
+*** 1,6 ****
+! int
+! main(void) {
+! b
+ a
+ a
+ a
+--- 1,5 ----
+! void
+! kmain(void) {
+ a
+ a
+ a
+*************** main(void) {
+*** 9,15 ****
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+--- 8,13 ----
+*************** main(void) {
+*** 17,22 ****
+--- 15,21 ----
+ a
+ a
+ a
++ c
+ a
+ a
+ a
+*************** main(void) {
+*** 24,30 ****
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+--- 23,28 ----
+*************** main(void) {
+*** 36,40 ****
+ a
+ a
+ a
+- b
+ }
+--- 34,37 ----
diff --git a/patch-test/26/patch-c0 b/patch-test/26/patch-c0
new file mode 100644
index 0000000..675dce6
--- /dev/null
+++ b/patch-test/26/patch-c0
@@ -0,0 +1,26 @@
+*** old 2016-03-18 23:20:46.950128155 +0100
+--- new 2016-03-18 23:20:45.210127585 +0100
+***************
+*** 1,3 ****
+! int
+! main(void) {
+! b
+--- 1,2 ----
+! void
+! kmain(void) {
+*************** main(void) {
+*** 12 ****
+- b
+--- 10 ----
+*************** main(void) {
+*** 19 ****
+--- 18 ----
++ c
+*************** main(void) {
+*** 27 ****
+- b
+--- 25 ----
+*************** main(void) {
+*** 39 ****
+- b
+--- 36 ----
diff --git a/patch-test/26/patch-c1 b/patch-test/26/patch-c1
new file mode 100644
index 0000000..a38c2aa
--- /dev/null
+++ b/patch-test/26/patch-c1
@@ -0,0 +1,36 @@
+*** old 2016-03-18 23:20:46.950128155 +0100
+--- new 2016-03-18 23:20:45.210127585 +0100
+***************
+*** 1,4 ****
+! int
+! main(void) {
+! b
+ a
+--- 1,3 ----
+! void
+! kmain(void) {
+ a
+*************** main(void) {
+*** 11,13 ****
+ a
+- b
+ a
+--- 10,11 ----
+*************** main(void) {
+*** 19,20 ****
+--- 17,19 ----
+ a
++ c
+ a
+*************** main(void) {
+*** 26,28 ****
+ a
+- b
+ a
+--- 25,26 ----
+*************** main(void) {
+*** 38,40 ****
+ a
+- b
+ }
+--- 36,37 ----
diff --git a/patch-test/26/patch-e b/patch-test/26/patch-e
new file mode 100644
index 0000000..8749c83
--- /dev/null
+++ b/patch-test/26/patch-e
@@ -0,0 +1,10 @@
+39d
+27d
+19a
+ c
+.
+12d
+1,3c
+void
+kmain(void) {
+.
diff --git a/patch-test/26/patch-u b/patch-test/26/patch-u
new file mode 100644
index 0000000..dd45521
--- /dev/null
+++ b/patch-test/26/patch-u
@@ -0,0 +1,41 @@
+--- old 2016-03-18 23:20:46.950128155 +0100
++++ new 2016-03-18 23:20:45.210127585 +0100
+@@ -1,6 +1,5 @@
+-int
+-main(void) {
+- b
++void
++kmain(void) {
+ a
+ a
+ a
+@@ -9,7 +8,6 @@ main(void) {
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+@@ -17,6 +15,7 @@ main(void) {
+ a
+ a
+ a
++ c
+ a
+ a
+ a
+@@ -24,7 +23,6 @@ main(void) {
+ a
+ a
+ a
+- b
+ a
+ a
+ a
+@@ -36,5 +34,4 @@ main(void) {
+ a
+ a
+ a
+- b
+ }
diff --git a/patch-test/26/patch-u0 b/patch-test/26/patch-u0
new file mode 100644
index 0000000..4ce1dfd
--- /dev/null
+++ b/patch-test/26/patch-u0
@@ -0,0 +1,16 @@
+--- old 2016-03-18 23:20:46.950128155 +0100
++++ new 2016-03-18 23:20:45.210127585 +0100
+@@ -1,3 +1,2 @@
+-int
+-main(void) {
+- b
++void
++kmain(void) {
+@@ -12 +10,0 @@ main(void) {
+- b
+@@ -19,0 +18 @@ main(void) {
++ c
+@@ -27 +25,0 @@ main(void) {
+- b
+@@ -39 +36,0 @@ main(void) {
+- b
diff --git a/patch-test/26/patch-u1 b/patch-test/26/patch-u1
new file mode 100644
index 0000000..10f09d2
--- /dev/null
+++ b/patch-test/26/patch-u1
@@ -0,0 +1,25 @@
+--- old 2016-03-18 23:20:46.950128155 +0100
++++ new 2016-03-18 23:20:45.210127585 +0100
+@@ -1,4 +1,3 @@
+-int
+-main(void) {
+- b
++void
++kmain(void) {
+ a
+@@ -11,3 +10,2 @@ main(void) {
+ a
+- b
+ a
+@@ -19,2 +17,3 @@ main(void) {
+ a
++ c
+ a
+@@ -26,3 +25,2 @@ main(void) {
+ a
+- b
+ a
+@@ -38,3 +36,2 @@ main(void) {
+ a
+- b
+ }
diff --git a/patch-test/3/def b/patch-test/3/def
new file mode 100644
index 0000000..7c5bac5
--- /dev/null
+++ b/patch-test/3/def
@@ -0,0 +1,5 @@
+#ifndef x
+hi
+#else
+hej
+#endif
diff --git a/patch-test/3/new b/patch-test/3/new
new file mode 100644
index 0000000..eca14b8
--- /dev/null
+++ b/patch-test/3/new
@@ -0,0 +1 @@
+hej \ No newline at end of file
diff --git a/patch-test/3/old b/patch-test/3/old
new file mode 100644
index 0000000..45b983b
--- /dev/null
+++ b/patch-test/3/old
@@ -0,0 +1 @@
+hi
diff --git a/patch-test/3/patch b/patch-test/3/patch
new file mode 100644
index 0000000..a18eafd
--- /dev/null
+++ b/patch-test/3/patch
@@ -0,0 +1,5 @@
+1c1
+< hi
+---
+> hej
+\ No newline at end of file
diff --git a/patch-test/3/patch-c b/patch-test/3/patch-c
new file mode 100644
index 0000000..25c57ea
--- /dev/null
+++ b/patch-test/3/patch-c
@@ -0,0 +1,8 @@
+*** old 2016-03-11 09:32:26.278546944 +0100
+--- new 2016-03-11 09:32:20.328544692 +0100
+***************
+*** 1 ****
+! hi
+--- 1 ----
+! hej
+\ No newline at end of file
diff --git a/patch-test/3/patch-c0 b/patch-test/3/patch-c0
new file mode 100644
index 0000000..25c57ea
--- /dev/null
+++ b/patch-test/3/patch-c0
@@ -0,0 +1,8 @@
+*** old 2016-03-11 09:32:26.278546944 +0100
+--- new 2016-03-11 09:32:20.328544692 +0100
+***************
+*** 1 ****
+! hi
+--- 1 ----
+! hej
+\ No newline at end of file
diff --git a/patch-test/3/patch-c1 b/patch-test/3/patch-c1
new file mode 100644
index 0000000..25c57ea
--- /dev/null
+++ b/patch-test/3/patch-c1
@@ -0,0 +1,8 @@
+*** old 2016-03-11 09:32:26.278546944 +0100
+--- new 2016-03-11 09:32:20.328544692 +0100
+***************
+*** 1 ****
+! hi
+--- 1 ----
+! hej
+\ No newline at end of file
diff --git a/patch-test/3/patch-u b/patch-test/3/patch-u
new file mode 100644
index 0000000..e36bc04
--- /dev/null
+++ b/patch-test/3/patch-u
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:32:26.278546944 +0100
++++ new 2016-03-11 09:32:20.328544692 +0100
+@@ -1 +1 @@
+-hi
++hej
+\ No newline at end of file
diff --git a/patch-test/3/patch-u0 b/patch-test/3/patch-u0
new file mode 100644
index 0000000..e36bc04
--- /dev/null
+++ b/patch-test/3/patch-u0
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:32:26.278546944 +0100
++++ new 2016-03-11 09:32:20.328544692 +0100
+@@ -1 +1 @@
+-hi
++hej
+\ No newline at end of file
diff --git a/patch-test/3/patch-u1 b/patch-test/3/patch-u1
new file mode 100644
index 0000000..e36bc04
--- /dev/null
+++ b/patch-test/3/patch-u1
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:32:26.278546944 +0100
++++ new 2016-03-11 09:32:20.328544692 +0100
+@@ -1 +1 @@
+-hi
++hej
+\ No newline at end of file
diff --git a/patch-test/4/def b/patch-test/4/def
new file mode 100644
index 0000000..7c5bac5
--- /dev/null
+++ b/patch-test/4/def
@@ -0,0 +1,5 @@
+#ifndef x
+hi
+#else
+hej
+#endif
diff --git a/patch-test/4/new b/patch-test/4/new
new file mode 100644
index 0000000..1b5b67f
--- /dev/null
+++ b/patch-test/4/new
@@ -0,0 +1 @@
+hej
diff --git a/patch-test/4/old b/patch-test/4/old
new file mode 100644
index 0000000..32f95c0
--- /dev/null
+++ b/patch-test/4/old
@@ -0,0 +1 @@
+hi \ No newline at end of file
diff --git a/patch-test/4/patch b/patch-test/4/patch
new file mode 100644
index 0000000..68c3277
--- /dev/null
+++ b/patch-test/4/patch
@@ -0,0 +1,5 @@
+1c1
+< hi
+\ No newline at end of file
+---
+> hej
diff --git a/patch-test/4/patch-c b/patch-test/4/patch-c
new file mode 100644
index 0000000..8734155
--- /dev/null
+++ b/patch-test/4/patch-c
@@ -0,0 +1,8 @@
+*** old 2016-03-11 09:33:02.445227270 +0100
+--- new 2016-03-11 09:33:02.358560570 +0100
+***************
+*** 1 ****
+! hi
+\ No newline at end of file
+--- 1 ----
+! hej
diff --git a/patch-test/4/patch-c0 b/patch-test/4/patch-c0
new file mode 100644
index 0000000..8734155
--- /dev/null
+++ b/patch-test/4/patch-c0
@@ -0,0 +1,8 @@
+*** old 2016-03-11 09:33:02.445227270 +0100
+--- new 2016-03-11 09:33:02.358560570 +0100
+***************
+*** 1 ****
+! hi
+\ No newline at end of file
+--- 1 ----
+! hej
diff --git a/patch-test/4/patch-c1 b/patch-test/4/patch-c1
new file mode 100644
index 0000000..8734155
--- /dev/null
+++ b/patch-test/4/patch-c1
@@ -0,0 +1,8 @@
+*** old 2016-03-11 09:33:02.445227270 +0100
+--- new 2016-03-11 09:33:02.358560570 +0100
+***************
+*** 1 ****
+! hi
+\ No newline at end of file
+--- 1 ----
+! hej
diff --git a/patch-test/4/patch-u b/patch-test/4/patch-u
new file mode 100644
index 0000000..8fe9a57
--- /dev/null
+++ b/patch-test/4/patch-u
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:33:02.445227270 +0100
++++ new 2016-03-11 09:33:02.358560570 +0100
+@@ -1 +1 @@
+-hi
+\ No newline at end of file
++hej
diff --git a/patch-test/4/patch-u0 b/patch-test/4/patch-u0
new file mode 100644
index 0000000..8fe9a57
--- /dev/null
+++ b/patch-test/4/patch-u0
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:33:02.445227270 +0100
++++ new 2016-03-11 09:33:02.358560570 +0100
+@@ -1 +1 @@
+-hi
+\ No newline at end of file
++hej
diff --git a/patch-test/4/patch-u1 b/patch-test/4/patch-u1
new file mode 100644
index 0000000..8fe9a57
--- /dev/null
+++ b/patch-test/4/patch-u1
@@ -0,0 +1,6 @@
+--- old 2016-03-11 09:33:02.445227270 +0100
++++ new 2016-03-11 09:33:02.358560570 +0100
+@@ -1 +1 @@
+-hi
+\ No newline at end of file
++hej
diff --git a/patch-test/5/def b/patch-test/5/def
new file mode 100644
index 0000000..790d564
--- /dev/null
+++ b/patch-test/5/def
@@ -0,0 +1,3 @@
+#ifdef x
+hej
+#endif
diff --git a/patch-test/5/new b/patch-test/5/new
new file mode 100644
index 0000000..1b5b67f
--- /dev/null
+++ b/patch-test/5/new
@@ -0,0 +1 @@
+hej
diff --git a/patch-test/5/old b/patch-test/5/old
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/patch-test/5/old
diff --git a/patch-test/5/patch b/patch-test/5/patch
new file mode 100644
index 0000000..2470dd7
--- /dev/null
+++ b/patch-test/5/patch
@@ -0,0 +1,2 @@
+0a1
+> hej
diff --git a/patch-test/5/patch-c b/patch-test/5/patch-c
new file mode 100644
index 0000000..2f90d56
--- /dev/null
+++ b/patch-test/5/patch-c
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:34:48.151934532 +0100
+--- new 2016-03-11 09:34:39.628597923 +0100
+***************
+*** 0 ****
+--- 1 ----
++ hej
diff --git a/patch-test/5/patch-c0 b/patch-test/5/patch-c0
new file mode 100644
index 0000000..2f90d56
--- /dev/null
+++ b/patch-test/5/patch-c0
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:34:48.151934532 +0100
+--- new 2016-03-11 09:34:39.628597923 +0100
+***************
+*** 0 ****
+--- 1 ----
++ hej
diff --git a/patch-test/5/patch-c1 b/patch-test/5/patch-c1
new file mode 100644
index 0000000..2f90d56
--- /dev/null
+++ b/patch-test/5/patch-c1
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:34:48.151934532 +0100
+--- new 2016-03-11 09:34:39.628597923 +0100
+***************
+*** 0 ****
+--- 1 ----
++ hej
diff --git a/patch-test/5/patch-e b/patch-test/5/patch-e
new file mode 100644
index 0000000..c0b5261
--- /dev/null
+++ b/patch-test/5/patch-e
@@ -0,0 +1,3 @@
+0a
+hej
+.
diff --git a/patch-test/5/patch-u b/patch-test/5/patch-u
new file mode 100644
index 0000000..1cde16a
--- /dev/null
+++ b/patch-test/5/patch-u
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:34:48.151934532 +0100
++++ new 2016-03-11 09:34:39.628597923 +0100
+@@ -0,0 +1 @@
++hej
diff --git a/patch-test/5/patch-u0 b/patch-test/5/patch-u0
new file mode 100644
index 0000000..1cde16a
--- /dev/null
+++ b/patch-test/5/patch-u0
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:34:48.151934532 +0100
++++ new 2016-03-11 09:34:39.628597923 +0100
+@@ -0,0 +1 @@
++hej
diff --git a/patch-test/5/patch-u1 b/patch-test/5/patch-u1
new file mode 100644
index 0000000..1cde16a
--- /dev/null
+++ b/patch-test/5/patch-u1
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:34:48.151934532 +0100
++++ new 2016-03-11 09:34:39.628597923 +0100
+@@ -0,0 +1 @@
++hej
diff --git a/patch-test/6/def b/patch-test/6/def
new file mode 100644
index 0000000..790d564
--- /dev/null
+++ b/patch-test/6/def
@@ -0,0 +1,3 @@
+#ifdef x
+hej
+#endif
diff --git a/patch-test/6/new b/patch-test/6/new
new file mode 100644
index 0000000..eca14b8
--- /dev/null
+++ b/patch-test/6/new
@@ -0,0 +1 @@
+hej \ No newline at end of file
diff --git a/patch-test/6/old b/patch-test/6/old
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/patch-test/6/old
diff --git a/patch-test/6/patch b/patch-test/6/patch
new file mode 100644
index 0000000..a86bdb9
--- /dev/null
+++ b/patch-test/6/patch
@@ -0,0 +1,3 @@
+0a1
+> hej
+\ No newline at end of file
diff --git a/patch-test/6/patch-c b/patch-test/6/patch-c
new file mode 100644
index 0000000..2881368
--- /dev/null
+++ b/patch-test/6/patch-c
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:35:03.871940582 +0100
+--- new 2016-03-11 09:35:16.231945330 +0100
+***************
+*** 0 ****
+--- 1 ----
++ hej
+\ No newline at end of file
diff --git a/patch-test/6/patch-c0 b/patch-test/6/patch-c0
new file mode 100644
index 0000000..2881368
--- /dev/null
+++ b/patch-test/6/patch-c0
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:35:03.871940582 +0100
+--- new 2016-03-11 09:35:16.231945330 +0100
+***************
+*** 0 ****
+--- 1 ----
++ hej
+\ No newline at end of file
diff --git a/patch-test/6/patch-c1 b/patch-test/6/patch-c1
new file mode 100644
index 0000000..2881368
--- /dev/null
+++ b/patch-test/6/patch-c1
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:35:03.871940582 +0100
+--- new 2016-03-11 09:35:16.231945330 +0100
+***************
+*** 0 ****
+--- 1 ----
++ hej
+\ No newline at end of file
diff --git a/patch-test/6/patch-u b/patch-test/6/patch-u
new file mode 100644
index 0000000..26b8657
--- /dev/null
+++ b/patch-test/6/patch-u
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:35:03.871940582 +0100
++++ new 2016-03-11 09:35:16.231945330 +0100
+@@ -0,0 +1 @@
++hej
+\ No newline at end of file
diff --git a/patch-test/6/patch-u0 b/patch-test/6/patch-u0
new file mode 100644
index 0000000..26b8657
--- /dev/null
+++ b/patch-test/6/patch-u0
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:35:03.871940582 +0100
++++ new 2016-03-11 09:35:16.231945330 +0100
+@@ -0,0 +1 @@
++hej
+\ No newline at end of file
diff --git a/patch-test/6/patch-u1 b/patch-test/6/patch-u1
new file mode 100644
index 0000000..26b8657
--- /dev/null
+++ b/patch-test/6/patch-u1
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:35:03.871940582 +0100
++++ new 2016-03-11 09:35:16.231945330 +0100
+@@ -0,0 +1 @@
++hej
+\ No newline at end of file
diff --git a/patch-test/7/def b/patch-test/7/def
new file mode 100644
index 0000000..fb9e211
--- /dev/null
+++ b/patch-test/7/def
@@ -0,0 +1,3 @@
+#ifndef x
+hej
+#endif
diff --git a/patch-test/7/new b/patch-test/7/new
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/patch-test/7/new
diff --git a/patch-test/7/old b/patch-test/7/old
new file mode 100644
index 0000000..1b5b67f
--- /dev/null
+++ b/patch-test/7/old
@@ -0,0 +1 @@
+hej
diff --git a/patch-test/7/patch b/patch-test/7/patch
new file mode 100644
index 0000000..69a3ebf
--- /dev/null
+++ b/patch-test/7/patch
@@ -0,0 +1,2 @@
+1d0
+< hej
diff --git a/patch-test/7/patch-c b/patch-test/7/patch-c
new file mode 100644
index 0000000..79cae51
--- /dev/null
+++ b/patch-test/7/patch-c
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:35:42.001955231 +0100
+--- new 2016-03-11 09:35:42.025288573 +0100
+***************
+*** 1 ****
+- hej
+--- 0 ----
diff --git a/patch-test/7/patch-c0 b/patch-test/7/patch-c0
new file mode 100644
index 0000000..79cae51
--- /dev/null
+++ b/patch-test/7/patch-c0
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:35:42.001955231 +0100
+--- new 2016-03-11 09:35:42.025288573 +0100
+***************
+*** 1 ****
+- hej
+--- 0 ----
diff --git a/patch-test/7/patch-c1 b/patch-test/7/patch-c1
new file mode 100644
index 0000000..79cae51
--- /dev/null
+++ b/patch-test/7/patch-c1
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:35:42.001955231 +0100
+--- new 2016-03-11 09:35:42.025288573 +0100
+***************
+*** 1 ****
+- hej
+--- 0 ----
diff --git a/patch-test/7/patch-e b/patch-test/7/patch-e
new file mode 100644
index 0000000..b6fe86e
--- /dev/null
+++ b/patch-test/7/patch-e
@@ -0,0 +1 @@
+1d
diff --git a/patch-test/7/patch-u b/patch-test/7/patch-u
new file mode 100644
index 0000000..45cebbb
--- /dev/null
+++ b/patch-test/7/patch-u
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:35:42.001955231 +0100
++++ new 2016-03-11 09:35:42.025288573 +0100
+@@ -1 +0,0 @@
+-hej
diff --git a/patch-test/7/patch-u0 b/patch-test/7/patch-u0
new file mode 100644
index 0000000..45cebbb
--- /dev/null
+++ b/patch-test/7/patch-u0
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:35:42.001955231 +0100
++++ new 2016-03-11 09:35:42.025288573 +0100
+@@ -1 +0,0 @@
+-hej
diff --git a/patch-test/7/patch-u1 b/patch-test/7/patch-u1
new file mode 100644
index 0000000..45cebbb
--- /dev/null
+++ b/patch-test/7/patch-u1
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:35:42.001955231 +0100
++++ new 2016-03-11 09:35:42.025288573 +0100
+@@ -1 +0,0 @@
+-hej
diff --git a/patch-test/8/def b/patch-test/8/def
new file mode 100644
index 0000000..fb9e211
--- /dev/null
+++ b/patch-test/8/def
@@ -0,0 +1,3 @@
+#ifndef x
+hej
+#endif
diff --git a/patch-test/8/new b/patch-test/8/new
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/patch-test/8/new
diff --git a/patch-test/8/old b/patch-test/8/old
new file mode 100644
index 0000000..eca14b8
--- /dev/null
+++ b/patch-test/8/old
@@ -0,0 +1 @@
+hej \ No newline at end of file
diff --git a/patch-test/8/patch b/patch-test/8/patch
new file mode 100644
index 0000000..1fc51c1
--- /dev/null
+++ b/patch-test/8/patch
@@ -0,0 +1,3 @@
+1d0
+< hej
+\ No newline at end of file
diff --git a/patch-test/8/patch-c b/patch-test/8/patch-c
new file mode 100644
index 0000000..fa63336
--- /dev/null
+++ b/patch-test/8/patch-c
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:36:05.391964211 +0100
+--- new 2016-03-11 09:36:05.435297563 +0100
+***************
+*** 1 ****
+- hej
+\ No newline at end of file
+--- 0 ----
diff --git a/patch-test/8/patch-c0 b/patch-test/8/patch-c0
new file mode 100644
index 0000000..fa63336
--- /dev/null
+++ b/patch-test/8/patch-c0
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:36:05.391964211 +0100
+--- new 2016-03-11 09:36:05.435297563 +0100
+***************
+*** 1 ****
+- hej
+\ No newline at end of file
+--- 0 ----
diff --git a/patch-test/8/patch-c1 b/patch-test/8/patch-c1
new file mode 100644
index 0000000..fa63336
--- /dev/null
+++ b/patch-test/8/patch-c1
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:36:05.391964211 +0100
+--- new 2016-03-11 09:36:05.435297563 +0100
+***************
+*** 1 ****
+- hej
+\ No newline at end of file
+--- 0 ----
diff --git a/patch-test/8/patch-u b/patch-test/8/patch-u
new file mode 100644
index 0000000..0f5aa24
--- /dev/null
+++ b/patch-test/8/patch-u
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:36:05.391964211 +0100
++++ new 2016-03-11 09:36:05.435297563 +0100
+@@ -1 +0,0 @@
+-hej
+\ No newline at end of file
diff --git a/patch-test/8/patch-u0 b/patch-test/8/patch-u0
new file mode 100644
index 0000000..0f5aa24
--- /dev/null
+++ b/patch-test/8/patch-u0
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:36:05.391964211 +0100
++++ new 2016-03-11 09:36:05.435297563 +0100
+@@ -1 +0,0 @@
+-hej
+\ No newline at end of file
diff --git a/patch-test/8/patch-u1 b/patch-test/8/patch-u1
new file mode 100644
index 0000000..0f5aa24
--- /dev/null
+++ b/patch-test/8/patch-u1
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:36:05.391964211 +0100
++++ new 2016-03-11 09:36:05.435297563 +0100
+@@ -1 +0,0 @@
+-hej
+\ No newline at end of file
diff --git a/patch-test/9/def b/patch-test/9/def
new file mode 100644
index 0000000..f044a40
--- /dev/null
+++ b/patch-test/9/def
@@ -0,0 +1,13 @@
+#ifdef x
+b
+#endif
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/9/new b/patch-test/9/new
new file mode 100644
index 0000000..6a57515
--- /dev/null
+++ b/patch-test/9/new
@@ -0,0 +1,11 @@
+b
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/9/old b/patch-test/9/old
new file mode 100644
index 0000000..d15112c
--- /dev/null
+++ b/patch-test/9/old
@@ -0,0 +1,10 @@
+a
+a
+a
+a
+a
+a
+a
+a
+a
+a
diff --git a/patch-test/9/patch b/patch-test/9/patch
new file mode 100644
index 0000000..230778b
--- /dev/null
+++ b/patch-test/9/patch
@@ -0,0 +1,2 @@
+0a1
+> b
diff --git a/patch-test/9/patch-c b/patch-test/9/patch-c
new file mode 100644
index 0000000..fa73175
--- /dev/null
+++ b/patch-test/9/patch-c
@@ -0,0 +1,9 @@
+*** old 2016-03-11 09:37:09.608655522 +0100
+--- new 2016-03-11 09:37:04.255320132 +0100
+***************
+*** 1,3 ****
+--- 1,4 ----
++ b
+ a
+ a
+ a
diff --git a/patch-test/9/patch-c0 b/patch-test/9/patch-c0
new file mode 100644
index 0000000..39e5a4b
--- /dev/null
+++ b/patch-test/9/patch-c0
@@ -0,0 +1,6 @@
+*** old 2016-03-11 09:37:09.608655522 +0100
+--- new 2016-03-11 09:37:04.255320132 +0100
+***************
+*** 0 ****
+--- 1 ----
++ b
diff --git a/patch-test/9/patch-c1 b/patch-test/9/patch-c1
new file mode 100644
index 0000000..5dd2548
--- /dev/null
+++ b/patch-test/9/patch-c1
@@ -0,0 +1,7 @@
+*** old 2016-03-11 09:37:09.608655522 +0100
+--- new 2016-03-11 09:37:04.255320132 +0100
+***************
+*** 1 ****
+--- 1,2 ----
++ b
+ a
diff --git a/patch-test/9/patch-e b/patch-test/9/patch-e
new file mode 100644
index 0000000..be6e842
--- /dev/null
+++ b/patch-test/9/patch-e
@@ -0,0 +1,3 @@
+0a
+b
+.
diff --git a/patch-test/9/patch-u b/patch-test/9/patch-u
new file mode 100644
index 0000000..8061672
--- /dev/null
+++ b/patch-test/9/patch-u
@@ -0,0 +1,7 @@
+--- old 2016-03-11 09:37:09.608655522 +0100
++++ new 2016-03-11 09:37:04.255320132 +0100
+@@ -1,3 +1,4 @@
++b
+ a
+ a
+ a
diff --git a/patch-test/9/patch-u0 b/patch-test/9/patch-u0
new file mode 100644
index 0000000..89f2712
--- /dev/null
+++ b/patch-test/9/patch-u0
@@ -0,0 +1,4 @@
+--- old 2016-03-11 09:37:09.608655522 +0100
++++ new 2016-03-11 09:37:04.255320132 +0100
+@@ -0,0 +1 @@
++b
diff --git a/patch-test/9/patch-u1 b/patch-test/9/patch-u1
new file mode 100644
index 0000000..97cdb12
--- /dev/null
+++ b/patch-test/9/patch-u1
@@ -0,0 +1,5 @@
+--- old 2016-03-11 09:37:09.608655522 +0100
++++ new 2016-03-11 09:37:04.255320132 +0100
+@@ -1 +1,2 @@
++b
+ a
diff --git a/patch-test/__test b/patch-test/__test
new file mode 100755
index 0000000..508d3ae
--- /dev/null
+++ b/patch-test/__test
@@ -0,0 +1,120 @@
+#!/bin/bash
+
+
+N=26
+
+if test -z "$PATCH"; then
+ PATCH=../../patch
+fi
+
+
+if test -z $NGARBAGE; then
+ NGARBAGE=0
+fi
+if test -z $UGARBAGE; then
+ UGARBAGE=0
+fi
+if test -z $CGARBAGE; then
+ CGARBAGE=0
+fi
+if test -z $EGARBAGE; then
+ EGARBAGE=0
+fi
+if test -z $OLDFILE; then
+ OLDFILE=old
+fi
+if test -z $NEWFILE; then
+ NEWFILE=new
+fi
+p="$PREFIX $PATCH $SUFFIX -o -"
+cd -- "$(dirname "$0")"
+if test $# = 0; then
+ set $(seq $N)
+fi
+run ()
+{
+ if test $1 = patch; then
+ x=$NGARBAGE
+ f=""
+ elif test $1 = patch-u; then
+ x=$UGARBAGE
+ f=" -u"
+ elif test $1 = patch-u0; then
+ x=$UGARBAGE
+ f=" -U0"
+ elif test $1 = patch-u1; then
+ x=$UGARBAGE
+ f=" -U1"
+ elif test $1 = patch-c; then
+ x=$CGARBAGE
+ f=" -c"
+ elif test $1 = patch-c0; then
+ x=$CGARBAGE
+ f=" -C0"
+ elif test $1 = patch-c1; then
+ x=$CGARBAGE
+ f=" -C1"
+ elif test $1 = patch-e; then
+ x=$EGARBAGE
+ f=" -e"
+ fi
+
+ if test -f $1; then
+ if test $2 = fuzzy || test $2 = applied; then
+ exec 3>&2
+ exec 2>tmp
+ fi
+
+ if test -z $IFLAG; then
+ if test $x = 0; then
+ diff <($p < $1 $OLDFILE) $NEWFILE > /dev/null
+ else
+ $p < $1 $OLDFILE > /dev/null
+ fi
+ else
+ if test $x = 0; then
+ diff <($p -i$1 $OLDFILE) $NEWFILE > /dev/null
+ else
+ $p -i$1 $OLDFILE > /dev/null
+ fi
+ fi
+ val=$?
+ if test $val = $x && test $2 = fuzzy; then
+ grep 'ward fuzz' < tmp >/dev/null
+ val=$?
+ elif test $val = $x && test $2 = applied; then
+ grep 'hunk number 2 of 2' < tmp >/dev/null
+ val=$?
+ fi
+
+ if test $val = $x; then
+ printf "\033[1;32mTest %s%s%s OK%s\033[m\n" "$LABEL" $2 "$f" "$3"
+ else
+ printf "\033[1;31mTest %s%s%s FAILED%s\033[m\n" "$LABEL" $2 "$f" "$3"
+ fi
+
+ if test $2 = fuzzy || test $2 = applied; then
+ exec 2>&3
+ exec 3>&-
+ rm tmp
+ fi
+ fi
+}
+for i in $@; do
+ cd $i
+ run patch $i
+ run patch-u $i
+ run patch-u0 $i
+ run patch-u1 $i
+ run patch-c $i
+ run patch-c0 $i
+ run patch-c1 $i
+ if test -z $SKIPE; then
+ if test -z $NPE; then
+ run patch-e $i
+ else
+ run patch-e $i " (NON-POSIX)"
+ fi
+ fi
+ cd ..
+done
diff --git a/patch-test/applied/new b/patch-test/applied/new
new file mode 100644
index 0000000..7b51def
--- /dev/null
+++ b/patch-test/applied/new
@@ -0,0 +1,10 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+changed
diff --git a/patch-test/applied/old b/patch-test/applied/old
new file mode 100644
index 0000000..36902b2
--- /dev/null
+++ b/patch-test/applied/old
@@ -0,0 +1,11 @@
+REMOVED
+1
+2
+3
+4
+5
+6
+7
+8
+9
+changed
diff --git a/patch-test/applied/patch-u b/patch-test/applied/patch-u
new file mode 100644
index 0000000..e33d86d
--- /dev/null
+++ b/patch-test/applied/patch-u
@@ -0,0 +1,13 @@
+--- old 2016-03-19 15:58:47.674014541 +0100
++++ new 2016-03-19 15:58:49.120681706 +0100
+@@ -1,4 +1,3 @@
+-REMOVED
+ 1
+ 2
+ 3
+@@ -8,4 +7,4 @@
+ 7
+ 8
+ 9
+-CHANGED
++changed
diff --git a/patch-test/ed/new b/patch-test/ed/new
new file mode 100644
index 0000000..6dc6b14
--- /dev/null
+++ b/patch-test/ed/new
@@ -0,0 +1,29 @@
+1
+2
+3
+C
+C
+4
+5
+6
+7
+8
+9
+a
+10
+11
+12
+i
+j
+13
+14
+15
+16
+a
+.
+a
+.
+17
+C
+18
+19
diff --git a/patch-test/ed/old b/patch-test/ed/old
new file mode 100644
index 0000000..e0c8831
--- /dev/null
+++ b/patch-test/ed/old
@@ -0,0 +1,25 @@
+r
+1
+2
+3
+c
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+c
+c
+18
+19
+r
+r
diff --git a/patch-test/ed/patch-e b/patch-test/ed/patch-e
new file mode 100644
index 0000000..a2c4e04
--- /dev/null
+++ b/patch-test/ed/patch-e
@@ -0,0 +1,26 @@
+24,25d
+20,21c
+C
+.
+18a
+a
+..
+.
+s/.//
+a
+a
+..
+.
+s/.//
+14a
+i
+j
+.
+11a
+a
+.
+5c
+C
+C
+.
+1d
diff --git a/patch-test/ed_i/new b/patch-test/ed_i/new
new file mode 100644
index 0000000..6dc6b14
--- /dev/null
+++ b/patch-test/ed_i/new
@@ -0,0 +1,29 @@
+1
+2
+3
+C
+C
+4
+5
+6
+7
+8
+9
+a
+10
+11
+12
+i
+j
+13
+14
+15
+16
+a
+.
+a
+.
+17
+C
+18
+19
diff --git a/patch-test/ed_i/old b/patch-test/ed_i/old
new file mode 100644
index 0000000..e0c8831
--- /dev/null
+++ b/patch-test/ed_i/old
@@ -0,0 +1,25 @@
+r
+1
+2
+3
+c
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+c
+c
+18
+19
+r
+r
diff --git a/patch-test/ed_i/patch-e b/patch-test/ed_i/patch-e
new file mode 100644
index 0000000..b5024fd
--- /dev/null
+++ b/patch-test/ed_i/patch-e
@@ -0,0 +1,26 @@
+24,25d
+20,21c
+C
+.
+18a
+a
+..
+.
+s/.//
+a
+a
+..
+.
+s/.//
+15i
+i
+j
+.
+11a
+a
+.
+5c
+C
+C
+.
+1d
diff --git a/patch-test/fuzzy/new b/patch-test/fuzzy/new
new file mode 100644
index 0000000..79c4937
--- /dev/null
+++ b/patch-test/fuzzy/new
@@ -0,0 +1,31 @@
+a
+a
+a
+a
+a
+b
+b
+b
+b
+b
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+added
diff --git a/patch-test/fuzzy/old b/patch-test/fuzzy/old
new file mode 100644
index 0000000..3fedf41
--- /dev/null
+++ b/patch-test/fuzzy/old
@@ -0,0 +1,30 @@
+a
+a
+a
+a
+a
+b
+b
+b
+b
+b
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
diff --git a/patch-test/fuzzy/patch-u b/patch-test/fuzzy/patch-u
new file mode 100644
index 0000000..45af370
--- /dev/null
+++ b/patch-test/fuzzy/patch-u
@@ -0,0 +1,7 @@
+--- old 2016-03-19 14:59:52.602841100 +0100
++++ new 2016-03-19 14:59:51.666174124 +0100
+@@ -18,3 +18,4 @@
+ 18
+ 19
+ 20
++added
diff --git a/patch-test/lflag/new b/patch-test/lflag/new
new file mode 100644
index 0000000..d265b35
--- /dev/null
+++ b/patch-test/lflag/new
@@ -0,0 +1,25 @@
+int
+main(void)
+{
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7 7
+ 8
+9
+ 10
+ added
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+}
diff --git a/patch-test/lflag/old b/patch-test/lflag/old
new file mode 100644
index 0000000..d8b7e96
--- /dev/null
+++ b/patch-test/lflag/old
@@ -0,0 +1,24 @@
+int
+main(void)
+{
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+}
diff --git a/patch-test/lflag/patch-u b/patch-test/lflag/patch-u
new file mode 100644
index 0000000..cbe0d6d
--- /dev/null
+++ b/patch-test/lflag/patch-u
@@ -0,0 +1,18 @@
+--- old 2016-03-19 00:57:08.008750725 +0100
++++ new 2016-03-19 01:01:19.722172759 +0100
+@@ -9,11 +9,12 @@
+ 6
+ 7 7
+ 8
+- 9
++9
+ 10
+- 11
++ added
++ 11
+ 12
+- 13
++ 13
+ 14
+ 15
+ 16
diff --git a/patch-test/reppatch_def/def b/patch-test/reppatch_def/def
new file mode 100644
index 0000000..9fabe57
--- /dev/null
+++ b/patch-test/reppatch_def/def
@@ -0,0 +1,53 @@
+0
+1
+2
+3
+#ifdef x
+added
+added
+#endif
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+#ifndef x
+16
+#endif
+17
+18
+#ifndef x
+19
+20
+#endif
+21
+22
+#ifndef x
+23
+24
+25
+#endif
+26
+27
+28
+29
+30
+31
+32
+#ifndef x
+33
+34
+35
+36
+37
+38
+39
+40
+#endif
diff --git a/patch-test/reppatch_def/def.alt1 b/patch-test/reppatch_def/def.alt1
new file mode 100644
index 0000000..cc0d82e
--- /dev/null
+++ b/patch-test/reppatch_def/def.alt1
@@ -0,0 +1,57 @@
+#ifndef x
+0
+#else
+0
+#endif
+1
+2
+3
+#ifdef x
+added
+added
+#endif
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+#ifndef x
+16
+#endif
+17
+18
+#ifndef x
+19
+20
+#endif
+21
+22
+#ifndef x
+23
+24
+25
+#endif
+26
+27
+28
+29
+30
+31
+32
+#ifndef x
+33
+34
+35
+36
+37
+38
+39
+40
+#endif
diff --git a/patch-test/reppatch_def/def.alt2 b/patch-test/reppatch_def/def.alt2
new file mode 100644
index 0000000..6c3f6db
--- /dev/null
+++ b/patch-test/reppatch_def/def.alt2
@@ -0,0 +1,57 @@
+#ifdef x
+0
+#else
+0
+#endif
+1
+2
+3
+#ifdef x
+added
+added
+#endif
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+#ifndef x
+16
+#endif
+17
+18
+#ifndef x
+19
+20
+#endif
+21
+22
+#ifndef x
+23
+24
+25
+#endif
+26
+27
+28
+29
+30
+31
+32
+#ifndef x
+33
+34
+35
+36
+37
+38
+39
+40
+#endif
diff --git a/patch-test/reppatch_def/inter b/patch-test/reppatch_def/inter
new file mode 100644
index 0000000..50d7dca
--- /dev/null
+++ b/patch-test/reppatch_def/inter
@@ -0,0 +1,35 @@
+1
+2
+3
+added
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+added
+17
+18
+21
+22
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
diff --git a/patch-test/reppatch_def/new b/patch-test/reppatch_def/new
new file mode 100644
index 0000000..450bef3
--- /dev/null
+++ b/patch-test/reppatch_def/new
@@ -0,0 +1,29 @@
+0
+1
+2
+3
+added
+added
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+17
+18
+21
+22
+26
+27
+28
+29
+30
+31
+32
diff --git a/patch-test/reppatch_def/old b/patch-test/reppatch_def/old
new file mode 100644
index 0000000..7ba036a
--- /dev/null
+++ b/patch-test/reppatch_def/old
@@ -0,0 +1,41 @@
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
diff --git a/patch-test/reppatch_def/patch b/patch-test/reppatch_def/patch
new file mode 100644
index 0000000..71ba12b
--- /dev/null
+++ b/patch-test/reppatch_def/patch
@@ -0,0 +1,32 @@
+1d0
+< 0
+4a4
+> added
+17a18
+> added
+20,21d20
+< 19
+< 20
+24,25d22
+< 23
+< 24
+39,41d35
+< 38
+< 39
+< 40
+%%%%%%%%%%%%%%%%
+0a1
+> 0
+4a6
+> added
+17,18d18
+< 16
+< added
+23d22
+< 25
+31,35d29
+< 33
+< 34
+< 35
+< 36
+< 37
diff --git a/patch-test/reppatch_def/patch-c b/patch-test/reppatch_def/patch-c
new file mode 100644
index 0000000..0fa92af
--- /dev/null
+++ b/patch-test/reppatch_def/patch-c
@@ -0,0 +1,97 @@
+*** old 2016-03-21 20:08:29.658690773 +0100
+--- inter 2016-03-21 13:57:10.940900591 +0100
+***************
+*** 1,7 ****
+- 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+--- 1,7 ----
+ 1
+ 2
+ 3
++ added
+ 4
+ 5
+ 6
+***************
+*** 15,28 ****
+ 14
+ 15
+ 16
+ 17
+ 18
+- 19
+- 20
+ 21
+ 22
+- 23
+- 24
+ 25
+ 26
+ 27
+--- 15,25 ----
+ 14
+ 15
+ 16
++ added
+ 17
+ 18
+ 21
+ 22
+ 25
+ 26
+ 27
+***************
+*** 36,41 ****
+ 35
+ 36
+ 37
+- 38
+- 39
+- 40
+--- 33,35 ----
+*** inter 2016-03-21 13:57:10.940900591 +0100
+--- new 2016-03-21 20:08:25.075356032 +0100
+***************
+*** 1,7 ****
+--- 1,9 ----
++ 0
+ 1
+ 2
+ 3
+ added
++ added
+ 4
+ 5
+ 6
+***************
+*** 14,26 ****
+ 13
+ 14
+ 15
+- 16
+- added
+ 17
+ 18
+ 21
+ 22
+- 25
+ 26
+ 27
+ 28
+--- 16,25 ----
+***************
+*** 28,35 ****
+ 30
+ 31
+ 32
+- 33
+- 34
+- 35
+- 36
+- 37
+--- 27,29 ----
diff --git a/patch-test/reppatch_def/patch-c0 b/patch-test/reppatch_def/patch-c0
new file mode 100644
index 0000000..aeb8e8d
--- /dev/null
+++ b/patch-test/reppatch_def/patch-c0
@@ -0,0 +1,57 @@
+*** old 2016-03-21 20:08:29.658690773 +0100
+--- inter 2016-03-21 13:57:10.940900591 +0100
+***************
+*** 1 ****
+- 0
+--- 0 ----
+***************
+*** 4 ****
+--- 4 ----
++ added
+***************
+*** 17 ****
+--- 18 ----
++ added
+***************
+*** 20,21 ****
+- 19
+- 20
+--- 20 ----
+***************
+*** 24,25 ****
+- 23
+- 24
+--- 22 ----
+***************
+*** 39,41 ****
+- 38
+- 39
+- 40
+--- 35 ----
+*** inter 2016-03-21 13:57:10.940900591 +0100
+--- new 2016-03-21 20:08:25.075356032 +0100
+***************
+*** 0 ****
+--- 1 ----
++ 0
+***************
+*** 4 ****
+--- 6 ----
++ added
+***************
+*** 17,18 ****
+- 16
+- added
+--- 18 ----
+***************
+*** 23 ****
+- 25
+--- 22 ----
+***************
+*** 31,35 ****
+- 33
+- 34
+- 35
+- 36
+- 37
+--- 29 ----
diff --git a/patch-test/reppatch_def/patch-c1 b/patch-test/reppatch_def/patch-c1
new file mode 100644
index 0000000..6c87bf8
--- /dev/null
+++ b/patch-test/reppatch_def/patch-c1
@@ -0,0 +1,75 @@
+*** old 2016-03-21 20:08:29.658690773 +0100
+--- inter 2016-03-21 13:57:10.940900591 +0100
+***************
+*** 1,2 ****
+- 0
+ 1
+--- 1 ----
+***************
+*** 4,5 ****
+--- 3,5 ----
+ 3
++ added
+ 4
+***************
+*** 17,26 ****
+ 16
+ 17
+ 18
+- 19
+- 20
+ 21
+ 22
+- 23
+- 24
+ 25
+--- 17,23 ----
+ 16
++ added
+ 17
+ 18
+ 21
+ 22
+ 25
+***************
+*** 38,41 ****
+ 37
+- 38
+- 39
+- 40
+--- 35 ----
+*** inter 2016-03-21 13:57:10.940900591 +0100
+--- new 2016-03-21 20:08:25.075356032 +0100
+***************
+*** 1 ****
+--- 1,2 ----
++ 0
+ 1
+***************
+*** 4,5 ****
+--- 5,7 ----
+ added
++ added
+ 4
+***************
+*** 16,19 ****
+ 15
+- 16
+- added
+ 17
+--- 18,19 ----
+***************
+*** 22,24 ****
+ 22
+- 25
+ 26
+--- 22,23 ----
+***************
+*** 30,35 ****
+ 32
+- 33
+- 34
+- 35
+- 36
+- 37
+--- 29 ----
diff --git a/patch-test/reppatch_def/patch-e b/patch-test/reppatch_def/patch-e
new file mode 100644
index 0000000..76a1b3c
--- /dev/null
+++ b/patch-test/reppatch_def/patch-e
@@ -0,0 +1,20 @@
+39,41d
+24,25d
+20,21d
+17a
+added
+.
+4a
+added
+.
+1d
+%%%%%%%%%%%%%%%%
+31,35d
+23d
+17,18d
+4a
+added
+.
+0a
+0
+.
diff --git a/patch-test/reppatch_def/patch-u b/patch-test/reppatch_def/patch-u
new file mode 100644
index 0000000..784b47c
--- /dev/null
+++ b/patch-test/reppatch_def/patch-u
@@ -0,0 +1,69 @@
+--- old 2016-03-21 20:08:29.658690773 +0100
++++ inter 2016-03-21 13:57:10.940900591 +0100
+@@ -1,7 +1,7 @@
+-0
+ 1
+ 2
+ 3
++added
+ 4
+ 5
+ 6
+@@ -15,14 +15,11 @@
+ 14
+ 15
+ 16
++added
+ 17
+ 18
+-19
+-20
+ 21
+ 22
+-23
+-24
+ 25
+ 26
+ 27
+@@ -36,6 +33,3 @@
+ 35
+ 36
+ 37
+-38
+-39
+-40
+--- inter 2016-03-21 13:57:10.940900591 +0100
++++ new 2016-03-21 20:08:25.075356032 +0100
+@@ -1,7 +1,9 @@
++0
+ 1
+ 2
+ 3
+ added
++added
+ 4
+ 5
+ 6
+@@ -14,13 +16,10 @@
+ 13
+ 14
+ 15
+-16
+-added
+ 17
+ 18
+ 21
+ 22
+-25
+ 26
+ 27
+ 28
+@@ -28,8 +27,3 @@
+ 30
+ 31
+ 32
+-33
+-34
+-35
+-36
+-37
diff --git a/patch-test/reppatch_def/patch-u0 b/patch-test/reppatch_def/patch-u0
new file mode 100644
index 0000000..390c601
--- /dev/null
+++ b/patch-test/reppatch_def/patch-u0
@@ -0,0 +1,35 @@
+--- old 2016-03-21 20:08:29.658690773 +0100
++++ inter 2016-03-21 13:57:10.940900591 +0100
+@@ -1 +0,0 @@
+-0
+@@ -4,0 +4 @@
++added
+@@ -17,0 +18 @@
++added
+@@ -20,2 +20,0 @@
+-19
+-20
+@@ -24,2 +22,0 @@
+-23
+-24
+@@ -39,3 +35,0 @@
+-38
+-39
+-40
+--- inter 2016-03-21 13:57:10.940900591 +0100
++++ new 2016-03-21 20:08:25.075356032 +0100
+@@ -0,0 +1 @@
++0
+@@ -4,0 +6 @@
++added
+@@ -17,2 +18,0 @@
+-16
+-added
+@@ -23 +22,0 @@
+-25
+@@ -31,5 +29,0 @@
+-33
+-34
+-35
+-36
+-37
diff --git a/patch-test/reppatch_def/patch-u1 b/patch-test/reppatch_def/patch-u1
new file mode 100644
index 0000000..7ba5ee4
--- /dev/null
+++ b/patch-test/reppatch_def/patch-u1
@@ -0,0 +1,51 @@
+--- old 2016-03-21 20:08:29.658690773 +0100
++++ inter 2016-03-21 13:57:10.940900591 +0100
+@@ -1,2 +1 @@
+-0
+ 1
+@@ -4,2 +3,3 @@
+ 3
++added
+ 4
+@@ -17,10 +17,7 @@
+ 16
++added
+ 17
+ 18
+-19
+-20
+ 21
+ 22
+-23
+-24
+ 25
+@@ -38,4 +35 @@
+ 37
+-38
+-39
+-40
+--- inter 2016-03-21 13:57:10.940900591 +0100
++++ new 2016-03-21 20:08:25.075356032 +0100
+@@ -1 +1,2 @@
++0
+ 1
+@@ -4,2 +5,3 @@
+ added
++added
+ 4
+@@ -16,4 +18,2 @@
+ 15
+-16
+-added
+ 17
+@@ -22,3 +22,2 @@
+ 22
+-25
+ 26
+@@ -30,6 +29 @@
+ 32
+-33
+-34
+-35
+-36
+-37
diff --git a/patch-test/test b/patch-test/test
new file mode 100755
index 0000000..edc5b78
--- /dev/null
+++ b/patch-test/test
@@ -0,0 +1,1672 @@
+#!/bin/bash
+
+
+
+if test -z "$PATCH"; then
+ PATCH=../../patch
+fi
+if test -z "$FORCE_PATCH"; then
+ FORCE_PATCH="$PATCH -f"
+fi
+p="$PREFIX $PATCH"
+fp="$PREFIX $FORCE_PATCH"
+
+
+
+cd -- "$(dirname "$0")"
+
+if test $# = 0; then
+(
+ env LABEL=1: ./__test
+ env LABEL=2: SUFFIX=-l ./__test
+ env LABEL=3: SUFFIX=-l ./__test lflag
+ env LABEL=4: OLDFILE=new NEWFILE=old SKIPE=x SUFFIX=-R ./__test
+ env LABEL=5: OLDFILE=new NEWFILE=old SKIPE=x SUFFIX=-Rl ./__test
+ env LABEL=6: OLDFILE=new NEWFILE=old SKIPE=x SUFFIX=-Rl ./__test lflag
+ env LABEL=7: CGARBAGE=2 UGARBAGE=2 EGARBAGE=2 SUFFIX=-n ./__test 2> /dev/null
+ env LABEL=8: CGARBAGE=2 NGARBAGE=2 EGARBAGE=2 SUFFIX=-u ./__test 2> /dev/null
+ env LABEL=9: UGARBAGE=2 NGARBAGE=2 EGARBAGE=2 SUFFIX=-c ./__test 2> /dev/null
+ env LABEL=9: CGARBAGE=2 UGARBAGE=2 NGARBAGE=2 SUFFIX=-e ./__test 2> /dev/null
+ env LABEL=10: IFLAG=x ./__test
+ env LABEL=11: SUFFIX=-N ./__test
+ env LABEL=12: SUFFIX=-r/dev/null ./__test
+ env LABEL=13: SUFFIX=-r/dev/null ./__test fuzzy applied ed ed_i
+ env LABEL=14: SUFFIX=-Nr/dev/null ./__test fuzzy applied
+ env LABEL=-Dx: SUFFIX=-Dx NPE=x NEWFILE=def ./__test
+) | tee result1
+fi
+
+report ()
+{
+ if test $1 = 0; then
+ printf "\033[1;32mTest %s OK\033[m\n" "$2"
+ else
+ printf "\033[1;31mTest %s FAILED\033[m\n" "$2"
+ fi
+}
+
+report_np ()
+{
+ if test $1 = 0; then
+ printf "\033[1;32mTest %s OK (NON-POSIX)\033[m\n" "$2"
+ else
+ printf "\033[1;31mTest %s FAILED (NON-POSIX)\033[m\n" "$2"
+ fi
+}
+
+
+
+reversed_q ()
+{
+ cd 20
+ printf "\033[1;34mPlease answer 'y' to the question.\033[m\n" >&2
+ diff <($p -o- new < patch) old > /dev/null
+ report $? "reversed_q"
+ cd ..
+}
+
+garbage ()
+{
+ cd 20
+ < patch sed 's/^/ /' | $p -o- old > /dev/null 2> tmp
+ test $? = 2 && grep 'contains only garbage' < tmp > /dev/null
+ report $? "garbage"
+ rm tmp
+ cd ..
+}
+
+dryrun_1 ()
+{
+ cd 20
+ $p -o/dev/null old < patch
+ report $? "dryrun_1"
+ cd ..
+}
+
+dryrun_2 ()
+{
+ cd 20
+ $fp -o/dev/null old < patch
+ report $? "dryrun_2"
+ cd ..
+}
+
+dryrun_3 ()
+{
+ cd 20
+ $fp -o/dev/null new < patch 2> /dev/null
+ test $? = 1
+ report $? "dryrun_3"
+ cd ..
+}
+
+bflag ()
+{
+ cd 20
+ if test -f tmp.orig; then
+ rm tmp.orig
+ fi
+ if test -f old.orig; then
+ rm old.orig
+ fi
+ echo 'this fill should already exist' > tmp
+ $p -b -otmp old < patch
+ test $? = 0 && test ! -f old.orig && test -f tmp.orig && diff old tmp.orig > /dev/null
+ report $? "bflag"
+ touch old.orig tmp.orig
+ rm old.orig tmp.orig tmp
+ cd ..
+}
+
+bflag_oflagless ()
+{
+ cd 20
+ if test -f old.orig; then
+ rm old.orig
+ fi
+ cp old tmp
+ $p -b old < patch
+ test $? = 0 && test -f old.orig && diff tmp old.orig > /dev/null
+ report $? "bflag_oflagless"
+ if test -f old.orig; then
+ rm old.orig
+ fi
+ mv tmp old
+ cd ..
+}
+
+bflag_dry ()
+{
+ cd 20
+ $p -b -o/dev/null old < patch
+ test $? = 0 && test ! -f old.orig
+ report $? "bflag_dry"
+ if test -f old.orig; then
+ rm old.orig
+ fi
+ cd ..
+}
+
+dash_file ()
+{
+ cd 20
+ diff <($p -o- -ipatch - < old) new > /dev/null
+ report $? "dash_file"
+ cd ..
+}
+
+det_file_1a ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff -u old new > patch-u
+ diff -c old new > patch-c
+ diff <($fp -o- < patch-u) new > /dev/null
+ report $? "det_file_1a -u"
+ diff <($fp -o- < patch-c) new > /dev/null
+ report $? "det_file_1a -c"
+ cd ..
+ rm -r tmp
+}
+
+det_file_1b ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff -u old new > patch-u
+ diff -c old new > patch-c
+ mv new new.proper
+ diff <($fp -o- < patch-u) new.proper > /dev/null
+ report $? "det_file_1b -u"
+ diff <($fp -o- < patch-c) new.proper > /dev/null
+ report $? "det_file_1b -c"
+ cd ..
+ rm -r tmp
+}
+
+det_file_2 ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff -u old new > patch-u
+ diff -c old new > patch-c
+ rm old
+ diff <($fp -o/dev/null < patch-u 2> /dev/null) new > /dev/null
+ test $? = 1
+ report $? "det_file_2 -u"
+ diff <($fp -o/dev/null < patch-c 2> /dev/null) new > /dev/null
+ test $? = 1
+ report $? "det_file_2 -c"
+ cd ..
+ rm -r tmp
+}
+
+det_file_3 ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ echo 'Index: old.proper' | tee patch-u > patch-c
+ diff -u old new >> patch-u
+ diff -c old new >> patch-c
+ mv old old.proper
+ mv new new.proper
+ diff <($fp -o- < patch-u) new.proper > /dev/null
+ report $? "det_file_3 -u"
+ diff <($fp -o- < patch-c) new.proper > /dev/null
+ report $? "det_file_3 -c"
+ cd ..
+ rm -r tmp
+}
+
+det_file_1a_3 ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ echo 'Index: phony' | tee patch-u > patch-c
+ diff -u old new >> patch-u
+ diff -c old new >> patch-c
+ diff <($fp -o- < patch-u) new > /dev/null
+ report $? "det_file_1a_3 -u"
+ diff <($fp -o- < patch-c) new > /dev/null
+ report $? "det_file_1a_3 -c"
+ cd ..
+ rm -r tmp
+}
+
+det_file_dl ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ echo 'diff a a a a a a a a old.proper new.proper' | tee patch-u > patch-c
+ diff -u old new >> patch-u
+ diff -c old new >> patch-c
+ mv old old.proper
+ mv new new.proper
+ diff <($fp -o- < patch-u) new.proper > /dev/null
+ report_np $? "det_file_dl -u"
+ diff <($fp -o- < patch-c) new.proper > /dev/null
+ report_np $? "det_file_dl -c"
+ cd ..
+ rm -r tmp
+}
+
+det_file_dl1 ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ echo 'diff a a a a a a a a old.proper new' | tee patch-u > patch-c
+ diff -u old new >> patch-u
+ diff -c old new >> patch-c
+ mv old old.proper
+ mv new new.proper
+ diff <($fp -o- < patch-u) new.proper > /dev/null
+ report_np $? "det_file_dl1 -u"
+ diff <($fp -o- < patch-c) new.proper > /dev/null
+ report_np $? "det_file_dl1 -c"
+ cd ..
+ rm -r tmp
+}
+
+det_file_dl2 ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ echo 'diff a a a a a a a a new old.proper' | tee patch-u > patch-c
+ diff -u old new >> patch-u
+ diff -c old new >> patch-c
+ mv old old.proper
+ mv new new.proper
+ diff <($fp -o- < patch-u) new.proper > /dev/null
+ report_np $? "det_file_dl2 -u"
+ diff <($fp -o- < patch-c) new.proper > /dev/null
+ report_np $? "det_file_dl2 -c"
+ cd ..
+ rm -r tmp
+}
+
+det_file_1a_dl ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ echo 'diff a a a a a a a phony phony' | tee patch-u > patch-c
+ diff -u old new >> patch-u
+ diff -c old new >> patch-c
+ diff <($fp -o- < patch-u) new > /dev/null
+ report $? "det_file_1a_dl -u"
+ diff <($fp -o- < patch-c) new > /dev/null
+ report $? "det_file_1a_dl -c"
+ cd ..
+ rm -r tmp
+}
+
+det_file_dl_3 ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ echo 'diff a a a a a a a a old.proper new.proper' | tee patch-u > patch-c
+ echo 'Index: x' >> patch-u
+ echo 'Index: x' >> patch-c
+ diff -u old new >> patch-u
+ diff -c old new >> patch-c
+ mv old old.proper
+ mv new new.proper
+ echo x > x
+ diff <($fp -o- < patch-u) new.proper > /dev/null
+ report_np $? "det_file_dl_3 -u"
+ diff <($fp -o- < patch-c) new.proper > /dev/null
+ report_np $? "det_file_dl_3 -c"
+ cd ..
+ rm -r tmp
+}
+
+det_file_5 ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff old new > patch
+ printf "\033[1;34mPlease answer 'old' to the question.\033[m\n" >&2
+ diff <($p -o- < patch) new > /dev/null
+ report $? "det_file_5"
+ cd ..
+ rm -r tmp
+}
+
+oflagless ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff old new > patch-u
+ $p old < patch-u
+ diff old new > /dev/null
+ report $? "oflagless -u"
+ cd ..
+ rm -r tmp
+}
+
+dflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff -u old new > patch-u
+ mkdir d
+ mv old new d
+ diff <($p -dd -o- < patch-u) d/new > /dev/null
+ report $? "dflag -u"
+ cd ..
+ rm -r tmp
+}
+
+diflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff -u old new > patch-u
+ mkdir d
+ mv old new d
+ diff <($p -dd -o- -ipatch-u) d/new > /dev/null
+ report $? "diflag -u"
+ cd ..
+ rm -r tmp
+}
+
+pflagless ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/d
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > d/old
+ printf '%s\n' 1 2 3 x 4 5 > d/new
+ diff -u d/old d/new > patch-u
+ mv d/old d/new .
+ diff <($p -o- < patch-u) new > /dev/null
+ report $? "pflagless -u"
+ cd ..
+ rm -r tmp
+}
+
+p0flag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ diff <($p -p0 -o- < patch-u) a/b/c/new > /dev/null
+ report $? "p0flag -u"
+ cd ..
+ rm -r tmp
+}
+
+p1flag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new b/c
+ diff <($p -p1 -o- < patch-u) b/c/new > /dev/null
+ report $? "p1flag -u"
+ cd ..
+ rm -r tmp
+}
+
+p2flag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new c
+ diff <($p -p2 -o- < patch-u) c/new > /dev/null
+ report $? "p2flag -u"
+ cd ..
+ rm -r tmp
+}
+
+p1flag_slash ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ sed -i s:a/b/c:///a//b//c:g patch-u
+ diff <($p -p1 -o- < patch-u) a/b/c/new > /dev/null
+ report $? "p1flag_slash -u"
+ cd ..
+ rm -r tmp
+}
+
+pdflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/d/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new d/b/c
+ diff <($p -p1 -dd -o- < patch-u) d/b/c/new > /dev/null
+ report $? "pdflag -u"
+ cd ..
+ rm -r tmp
+}
+
+multipatch ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old-1
+ printf '%s\n' 1 2 3 x 4 5 > new-1
+ printf '%s\n' a b c d e > old-2
+ printf '%s\n' a b c @ d e > new-2
+
+ diff -u old-1 new-1 > patch-uc
+ diff -c old-2 new-2 >> patch-uc
+
+ echo 'Index: old-1' > patch-e
+ diff -e old-1 new-1 >> patch-e
+ echo 'Index: old-2' >> patch-e
+ diff -e old-2 new-2 >> patch-e
+
+ echo 'Index: old-1' > patch
+ diff old-1 new-1 >> patch
+ echo 'Index: old-2' >> patch
+ diff old-2 new-2 >> patch
+
+ cp old-1 1 && cp old-2 2
+ $p < patch-uc && diff old-1 new-1 > /dev/null && diff old-2 new-2 > /dev/null
+ report $? "multipatch -uc"
+ cp 1 old-1 && cp 2 old-2
+ $p < patch-e && diff old-1 new-1 > /dev/null && diff old-2 new-2 > /dev/null
+ report $? "multipatch -e"
+ cp 1 old-1 && cp 2 old-2
+ $p < patch && diff old-1 new-1 > /dev/null && diff old-2 new-2 > /dev/null
+ report $? "multipatch"
+ cd ..
+ rm -r tmp
+}
+
+multipatch_oflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old-1
+ printf '%s\n' 1 2 3 x 4 5 > new-1
+ printf '%s\n' a b c d e > old-2
+ printf '%s\n' a b c @ d e > new-2
+ diff -u old-1 new-1 > patch
+ diff -c old-2 new-2 >> patch
+ diff <($p -o- < patch) <(cat new-1 new-2) > /dev/null
+ report $? "multipatch_oflag -uc"
+ cd ..
+ rm -r tmp
+}
+
+reppatch ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a
+ printf '%s\n' 1 2 3 x 4 5 > b
+ printf '%s\n' 1 2 3 x 4 5 y > c
+
+ diff -u a b > patch-uc
+ diff -c b c >> patch-uc
+
+ diff -e a b > patch-e
+ echo '%%%%%%%%%%%%%' >> patch-e
+ diff -e b c >> patch-e
+
+ diff a b > patch
+ echo '%%%%%%%%%%%%%' >> patch
+ diff b c >> patch
+
+ cp a a.saved
+ $p a < patch-uc && diff a c > /dev/null
+ report $? "reppatch -uc"
+ cp a.saved a
+ $p a < patch-e && diff a c > /dev/null
+ report $? "reppatch -e"
+ cp a.saved a
+ $p a < patch && diff a c > /dev/null
+ report $? "reppatch"
+ cd ..
+ rm -r tmp
+}
+
+reppatch_oflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a
+ printf '%s\n' 1 2 3 x 4 5 > b
+ printf '%s\n' 1 2 3 x 4 5 y > c
+ diff -u a b > patch
+ diff -c b c >> patch
+ diff <($p -o- a < patch) <(cat b c) > /dev/null
+ report $? "reppatch_oflag -uc"
+ cd ..
+ rm -r tmp
+}
+
+reppatch_bflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a
+ cp a a.saved
+ printf '%s\n' 1 2 3 x 4 5 > b
+ printf '%s\n' 1 2 3 x 4 5 y > c
+ diff -u a b > patch
+ diff -c b c >> patch
+ $p -b a < patch
+ diff a c > /dev/null && test -f a.orig && diff a.orig a.saved > /dev/null
+ report $? "reppatch_bflag -uc"
+ cd ..
+ rm -r tmp
+}
+
+multipatch_bflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old-1
+ printf '%s\n' 1 2 3 x 4 5 > new-1
+ printf '%s\n' a b c d e > old-2
+ printf '%s\n' a b c @ d e > new-2
+ cp old-1 old-1.saved
+ cp old-2 old-2.saved
+ diff -u old-1 new-1 > patch
+ diff -c old-2 new-2 >> patch
+ $p -b < patch
+ diff old-1 new-1 > /dev/null && diff old-2 new-2 > /dev/null && \
+ test -f old-1.orig && diff old-1.orig old-1.saved > /dev/null && \
+ test -f old-2.orig && diff old-2.orig old-2.saved > /dev/null
+ report $? "multipatch_bflag -uc"
+ cd ..
+ rm -r tmp
+}
+
+rflag_uflagless ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ echo 'this shall be overridden' > rej
+ diff -c old new > patch-c
+ ($fp -o/dev/null -rrej file < patch-c 2> /dev/null ; test $? = 1) &&
+ diff <($p -o - old < rej) new > /dev/null
+ report $? "rflag_uflagless -c"
+ cd ..
+ rm -r tmp
+}
+
+ruflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ echo 'this shall be overridden' > rej
+ diff -u old new > patch-u
+ ($fp -U -o/dev/null -rrej file < patch-u 2> /dev/null ; test $? = 1) &&
+ diff <($p -o - old < rej) new > /dev/null
+ report_np $? "ruflag -u"
+ cd ..
+ rm -r tmp
+}
+
+rflagless ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ echo 'this shall be overridden' > file.rej
+ diff -c old new > patch-c
+ ($fp file < patch-c 2> /dev/null ; test $? = 1) &&
+ diff <($p -o - old < file.rej) new > /dev/null
+ report $? "rflagless -c"
+ cd ..
+ rm -r tmp
+}
+
+dash_r ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ diff -c old new > patch-c
+ ($fp -o/dev/null -r- file < patch-c 2> /dev/null > rej ; test $? = 1) &&
+ diff <($p -o - old < rej) new > /dev/null
+ report $? "dash_r -c"
+ cd ..
+ rm -r tmp
+}
+
+dash_r_file ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ diff -c old new > patch-c
+ ($fp -o/dev/null -r- -ipatch-c - < file 2> /dev/null > rej ; test $? = 1) &&
+ diff <($p -o - old < rej) new > /dev/null
+ report $? "dash_r_file -c"
+ cd ..
+ rm -r tmp
+}
+
+dash_io ()
+{
+ cd 20
+ diff <($p -o- -i- old < patch) new > /dev/null
+ report $? "dash_io -c"
+ cd ..
+}
+
+dash_ri ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ diff -c old new > patch-c
+ ($fp -o/dev/null -r- -i- file < patch-c 2> /dev/null > rej ; test $? = 1) &&
+ diff <($p -o - old < rej) new > /dev/null
+ report $? "dash_ri -c"
+ cd ..
+ rm -r tmp
+}
+
+dash_o_file ()
+{
+ cd 20
+ diff <($p -o- -ipatch - < old) new > /dev/null
+ report $? "dash_o_file -c"
+ cd ..
+}
+
+dash_rio ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ diff -c old new > patch-c
+ ($fp -o- -r- -i- file < patch-c > output 2> /dev/null ; test $? = 1) &&
+ diff <(tail -n "$(wc -l < file)" < output) file > /dev/null &&
+ diff <($p -o - old < output) new > /dev/null
+ report $? "dash_rio -c"
+ cd ..
+ rm -r tmp
+}
+
+dash_ro_file ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ diff -c old new > patch-c
+ ($fp -o- -r- -ipatch-c - < file > output 2> /dev/null ; test $? = 1) &&
+ diff <(tail -n "$(wc -l < file)" < output) file > /dev/null &&
+ diff <($p -o - old < output) new > /dev/null
+ report $? "dash_ro_file -c"
+ cd ..
+ rm -r tmp
+}
+
+rej_dash_io ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ diff -c old new > patch-c
+ ($fp -o- -i- file < patch-c > output 2> /dev/null ; test $? = 1) &&
+ diff output file > /dev/null &&
+ diff <($p -o - old < -.rej) new > /dev/null
+ report $? "rej_dash_io -c"
+ cd ..
+ rm -r tmp
+}
+
+rej_dash_o_file ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ diff -c old new > patch-c
+ ($fp -o- -ipatch-c - < file > output 2> /dev/null ; test $? = 1) &&
+ diff output file > /dev/null &&
+ diff <($p -o - old < -.rej) new > /dev/null
+ report $? "rej_dash_o_file -c"
+ cd ..
+ rm -r tmp
+}
+
+dash_o_append ()
+{
+ cp -r 20 tmp
+ cd tmp
+ echo 'this shall be preserved' > output
+ $fp -o- old < patch >> output
+ sed -i 1d output
+ diff output new > /dev/null
+ report $? "dash_o_append"
+ cd ..
+ rm -r tmp
+}
+
+dash_o_truncate ()
+{
+ cp -r 20 tmp
+ cd tmp
+ echo 'this shall be overridden' > output
+ $fp -o- old < patch > output
+ diff output new > /dev/null
+ report $? "dash_o_truncate"
+ cd ..
+ rm -r tmp
+}
+
+stdout_o_append ()
+{
+ cp -r 20 tmp
+ cd tmp
+ echo 'this shall be preserved' > output
+ $fp -o/dev/fd/1 old < patch >> output
+ sed -i 1d output
+ diff output new > /dev/null
+ report $? "stdout_o_truncate"
+ cd ..
+ rm -r tmp
+}
+
+bflag_dash_rio ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ diff -c old new > patch-c
+ ($fp -b -o- -r- -i- file < patch-c > output 2> /dev/null ; test $? = 1) &&
+ diff <(tail -n "$(wc -l < file)" < output) file > /dev/null &&
+ diff <($p -o - old < output) new > /dev/null &&
+ test ! -f file.orig && test ! -f ./-.orig > /dev/null
+ report $? "bflag_dash_rio -c"
+ cd ..
+ rm -r tmp
+}
+
+bflag_dash_ro_file ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r > old
+ printf '%s\n' A 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > new
+ printf '%s\n' 1 2 a 3 4 5 6 7 8 9 10 11 xx 13 14 15 16 17 18 19 20 > file
+ diff -c old new > patch-c
+ ($fp -b -o- -r- -ipatch-c - < file > output 2> /dev/null ; test $? = 1) &&
+ diff <(tail -n "$(wc -l < file)" < output) file > /dev/null &&
+ diff <($p -o - old < output) new > /dev/null &&
+ test ! -f ./-.orig > /dev/null
+ report $? "bflag_ro_file -c"
+ cd ..
+ rm -r tmp
+}
+
+symlink ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ cp -r 20 tmp
+ cd tmp
+ mv old old.proper
+ ln -s old.proper old
+ $p old < patch &&
+ diff old.proper new > /dev/null &&
+ diff old new > /dev/null
+ test $? = 0 && test -L old
+ report $? "symlink"
+ cd ..
+ rm -r tmp
+}
+
+mode ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ cp -r 20 tmp
+ cd tmp
+ chmod 777 old
+ $p old < patch &&
+ diff old new > /dev/null &&
+ test $(stat old | grep Access | grep -Po '\([0-8]*/' | sed -e 's/^.//' -e 's/.$//') = 0777
+ report $? "mode"
+ cd ..
+ rm -r tmp
+}
+
+reppatch_ndef ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ cp -r reppatch_def tmp
+ cd tmp
+ cp old tmp
+ $p tmp < patch-u && diff tmp new > /dev/null
+ report $? "reppatch_ndef -u"
+ cp old tmp
+ $p tmp < patch-u0 && diff tmp new > /dev/null
+ report $? "reppatch_ndef -U0"
+ cp old tmp
+ $p tmp < patch-u1 && diff tmp new > /dev/null
+ report $? "reppatch_ndef -U1"
+ cp old tmp
+ $p tmp < patch-c && diff tmp new > /dev/null
+ report $? "reppatch_ndef -c"
+ cp old tmp
+ $p tmp < patch-c0 && diff tmp new > /dev/null
+ report $? "reppatch_ndef -C0"
+ cp old tmp
+ $p tmp < patch-c1 && diff tmp new > /dev/null
+ report $? "reppatch_ndef -C1"
+ cp old tmp
+ $p tmp < patch-e && diff tmp new > /dev/null
+ report $? "reppatch_ndef -e"
+ cp old tmp
+ $p tmp < patch && diff tmp new > /dev/null
+ report $? "reppatch_ndef"
+ cd ..
+ rm -r tmp
+}
+
+reppatch_def ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ cp -r reppatch_def tmp
+ cd tmp
+ cp old tmp
+ $p -Dx tmp < patch-u
+ if test $? = 0; then
+ if diff tmp def > /dev/null; then
+ printf "\033[1;32mTest reppatch_def -u OK\033[m\n"
+ elif diff tmp def.alt1 > /dev/null || diff tmp def.alt2 > /dev/null; then
+ printf "\033[1;33mTest reppatch_def -u ACCEPTABLE\033[m\n"
+ else
+ printf "\033[1;31mTest reppatch_def -u FAILED\033[m\n"
+ fi
+ else
+ printf "\033[1;31mTest reppatch_def -u FAILED\033[m\n"
+ fi
+ cp old tmp
+ $p -Dx tmp < patch-u0
+ if test $? = 0; then
+ if diff tmp def > /dev/null; then
+ printf "\033[1;32mTest reppatch_def -U0 OK\033[m\n"
+ elif diff tmp def.alt1 > /dev/null || diff tmp def.alt2 > /dev/null; then
+ printf "\033[1;33mTest reppatch_def -U0 ACCEPTABLE\033[m\n"
+ else
+ printf "\033[1;31mTest reppatch_def -U0 FAILED\033[m\n"
+ fi
+ else
+ printf "\033[1;31mTest reppatch_def -U0 FAILED\033[m\n"
+ fi
+ cp old tmp
+ $p -Dx tmp < patch-u1
+ if test $? = 0; then
+ if diff tmp def > /dev/null; then
+ printf "\033[1;32mTest reppatch_def -U1 OK\033[m\n"
+ elif diff tmp def.alt1 > /dev/null || diff tmp def.alt2 > /dev/null; then
+ printf "\033[1;33mTest reppatch_def -U1 ACCEPTABLE\033[m\n"
+ else
+ printf "\033[1;31mTest reppatch_def -U1 FAILED\033[m\n"
+ fi
+ else
+ printf "\033[1;31mTest reppatch_def -U1 FAILED\033[m\n"
+ fi
+ cp old tmp
+ $p -Dx tmp < patch-c
+ if test $? = 0; then
+ if diff tmp def > /dev/null; then
+ printf "\033[1;32mTest reppatch_def -c OK\033[m\n"
+ elif diff tmp def.alt1 > /dev/null || diff tmp def.alt2 > /dev/null; then
+ printf "\033[1;33mTest reppatch_def -c ACCEPTABLE\033[m\n"
+ else
+ printf "\033[1;31mTest reppatch_def -c FAILED\033[m\n"
+ fi
+ else
+ printf "\033[1;31mTest reppatch_def -c FAILED\033[m\n"
+ fi
+ cp old tmp
+ $p -Dx tmp < patch-c0
+ if test $? = 0; then
+ if diff tmp def > /dev/null; then
+ printf "\033[1;32mTest reppatch_def -C0 OK\033[m\n"
+ elif diff tmp def.alt1 > /dev/null || diff tmp def.alt2 > /dev/null; then
+ printf "\033[1;33mTest reppatch_def -C0 ACCEPTABLE\033[m\n"
+ else
+ printf "\033[1;31mTest reppatch_def -C0 FAILED\033[m\n"
+ fi
+ else
+ printf "\033[1;31mTest reppatch_def -C0 FAILED\033[m\n"
+ fi
+ cp old tmp
+ $p -Dx tmp < patch-c1
+ if test $? = 0; then
+ if diff tmp def > /dev/null; then
+ printf "\033[1;32mTest reppatch_def -C1 OK\033[m\n"
+ elif diff tmp def.alt1 > /dev/null || diff tmp def.alt2 > /dev/null; then
+ printf "\033[1;33mTest reppatch_def -C1 ACCEPTABLE\033[m\n"
+ else
+ printf "\033[1;31mTest reppatch_def -C1 FAILED\033[m\n"
+ fi
+ else
+ printf "\033[1;31mTest reppatch_def -C1 FAILED\033[m\n"
+ fi
+ cp old tmp
+ $p -Dx tmp < patch-e
+ if test $? = 0; then
+ if diff tmp def > /dev/null; then
+ printf "\033[1;32mTest reppatch_def -e OK\033[m\n"
+ elif diff tmp def.alt1 > /dev/null || diff tmp def.alt2 > /dev/null; then
+ printf "\033[1;33mTest reppatch_def -e ACCEPTABLE\033[m\n"
+ else
+ printf "\033[1;31mTest reppatch_def -e FAILED\033[m\n"
+ fi
+ else
+ printf "\033[1;31mTest reppatch_def -e FAILED\033[m\n"
+ fi
+ cp old tmp
+ $p -Dx tmp < patch
+ if test $? = 0; then
+ if diff tmp def > /dev/null; then
+ printf "\033[1;32mTest reppatch_def OK\033[m\n"
+ elif diff tmp def.alt1 > /dev/null || diff tmp def.alt2 > /dev/null; then
+ printf "\033[1;33mTest reppatch_def ACCEPTABLE\033[m\n"
+ else
+ printf "\033[1;31mTest reppatch_def FAILED\033[m\n"
+ fi
+ else
+ printf "\033[1;31mTest reppatch_def FAILED\033[m\n"
+ fi
+ cd ..
+ rm -r tmp
+}
+
+def_excl ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 > old
+ printf '%s\n' 1 x 2 > new
+ diff -u old new > patch-u
+ printf '%s\n' 1 '#ifndef x' x '#endif' 2 > new
+ $p -D\!x old < patch-u && diff old new > /dev/null
+ report_np $? "def_excl -u"
+ cd ..
+ rm -r tmp
+}
+
+def_zero ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 > old
+ printf '%s\n' 1 x 2 > new
+ diff -u old new > patch-u
+ printf '%s\n' 1 '#if 0' x '#endif' 2 > new
+ $p -D0 old < patch-u && diff old new > /dev/null
+ report_np $? "def_zero -u"
+ cd ..
+ rm -r tmp
+}
+
+def_one ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 > old
+ printf '%s\n' 1 x 2 > new
+ diff -u old new > patch-u
+ printf '%s\n' 1 '#if 1' x '#endif' 2 > new
+ $p -D1 old < patch-u && diff old new > /dev/null
+ report_np $? "def_one -u"
+ cd ..
+ rm -r tmp
+}
+
+def_excl_one ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 > old
+ printf '%s\n' 1 x 2 > new
+ diff -u old new > patch-u
+ printf '%s\n' 1 '#if 0' x '#endif' 2 > new
+ $p -D\!1 old < patch-u && diff old new > /dev/null
+ report_np $? "def_excl_one -u"
+ cd ..
+ rm -r tmp
+}
+
+rej_multipatch ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old-1
+ printf '%s\n' 1 2 3 x 4 5 > new-1
+ printf '%s\n' a b c d e > old-2
+ printf '%s\n' a b c @ d e > new-2
+ diff -c old-1 new-1 > patch-c
+ diff -c old-2 new-2 >> patch-c
+ mv old-1 old1.saved
+ mv old-2 old2.saved
+ cat > rej-1 <<EOF
+***************
+*** 1,5
+--- 1,6
+ 1
+ 2
+ 3
++ x
+ 4
+ 5
+EOF
+ cat > rej-2 <<EOF
+***************
+*** 1,5
+--- 1,6
+ a
+ b
+ c
++ @
+ d
+ e
+EOF
+ $fp < patch-c 2> /dev/null
+ test $? = 1 && test -f new-1.rej && test -f new-2.rej &&
+ diff <(sed -e 's/ \*\*\*\*$//' -e 's/ ----$//' < new-1.rej | sed 1,2d) rej-1 >/dev/null &&
+ diff <(sed -e 's/ \*\*\*\*$//' -e 's/ ----$//' < new-2.rej | sed 1,2d) rej-2 >/dev/null
+ report $? "multipatch -c"
+ cd ..
+ rm -r tmp
+}
+
+doflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff -u old new > patch-u
+ mkdir d
+ mv old new d
+ $p -dd -otmp < patch-u && diff tmp d/new > /dev/null
+ report $? "doflag -u"
+ cd ..
+ rm -r tmp
+}
+
+dioflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir tmp
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff -u old new > patch-u
+ mkdir d
+ mv old new d
+ $p -dd -otmp -ipatch-u && diff tmp d/new > /dev/null
+ report $? "dioflag -u"
+ cd ..
+ rm -r tmp
+}
+
+piflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new b/c
+ diff <($p -p1 -o- -ipatch-u) b/c/new > /dev/null
+ report $? "piflag -u"
+ cd ..
+ rm -r tmp
+}
+
+poflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new b/c
+ $p -p1 -otmp < patch-u && diff tmp b/c/new > /dev/null
+ report $? "poflag -u"
+ cd ..
+ rm -r tmp
+}
+
+pioflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new b/c
+ $p -p1 -otmp -ipatch-u && diff tmp b/c/new > /dev/null
+ report $? "pioflag -u"
+ cd ..
+ rm -r tmp
+}
+
+pdiflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/d/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new d/b/c
+ diff <($p -p1 -dd -o- -ipatch-u) d/b/c/new > /dev/null
+ report $? "pdiflag -u"
+ cd ..
+ rm -r tmp
+}
+
+pdioflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/d/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new d/b/c
+ $p -p1 -dd -otmp -ipatch-u && diff tmp d/b/c/new > /dev/null
+ report $? "pdioflag -u"
+ cd ..
+ rm -r tmp
+}
+
+pdoflag ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/d/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new d/b/c
+ $p -p1 -dd -otmp < patch-u && diff tmp d/b/c/new > /dev/null
+ report $? "pdoflag -u"
+ cd ..
+ rm -r tmp
+}
+
+pdflag_absolute ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/xx
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff -u -- "$(realpath old)" "$(realpath new)" > patch-u
+ diff <($fp -dxx -p0 -o- < patch-u) new > /dev/null
+ report $? "pdflag_absolute -u"
+ cd ..
+ rm -r tmp
+}
+
+explicit_absolute ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/xx
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff -u -- "$(realpath old)" "$(realpath new)" > patch-u
+ diff <($fp -d/ -p1 -o- < patch-u) new > /dev/null
+ report $? "explicit_absolute -u"
+ cd ..
+ rm -r tmp
+}
+
+pflag_excess ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new .
+ $fp -p1000 -o- < patch-u > /dev/null
+ test $? = 2
+ report $? "pflag_excess -u"
+ cd ..
+ rm -r tmp
+}
+
+pflag_excess_one ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/old a/b/c/new > patch-u
+ mv a/old a/b/c/new .
+ $p -R -p3 -o- new < patch-u > tmp
+ test $? = 0 && diff tmp old > /dev/null
+ report $? "pflag_excess_one -u"
+ cd ..
+ rm -r tmp
+}
+
+pflag_file ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/b/c
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new b/c
+ diff <($p -p3 -o- b/c/old < patch-u) b/c/new > /dev/null
+ report $? "pflag_file -u"
+ cd ..
+ rm -r tmp
+}
+
+dflag_file ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/xx
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > old
+ printf '%s\n' 1 2 3 x 4 5 > new
+ diff -u old new > patch-u
+ diff <($p -dxx -o- old < patch-u) new > /dev/null
+ report $? "dflag_file -u"
+ cd ..
+ rm -r tmp
+}
+
+pdflag_file ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ mkdir -p tmp/a/b/c tmp/b/c tmp/xx
+ cd tmp
+ printf '%s\n' 1 2 3 4 5 > a/b/c/old
+ printf '%s\n' 1 2 3 x 4 5 > a/b/c/new
+ diff -u a/b/c/old a/b/c/new > patch-u
+ mv a/b/c/old a/b/c/new b/c
+ diff <($p -dxx -p3 -o- b/c/old < patch-u) b/c/new > /dev/null
+ report $? "pdflag_file -u"
+ cd ..
+ rm -r tmp
+}
+
+nonascii_name ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ cp -r 20 tmp
+ cd tmp
+ mv new new.saved
+ cp old old.saved
+ mv old åäö
+ sed -i 's/old/åäö/' patch-u
+ sed -i 's/old/åäö/' patch-c
+ $p < patch-u > /dev/null && diff åäö new.saved > /dev/null
+ report_np $? "nonascii_name -u"
+ cp old.saved åäö
+ $p < patch-c > /dev/null && diff åäö new.saved > /dev/null
+ report_np $? "nonascii_name -c"
+ cd ..
+ rm -r tmp
+}
+
+nonascii_name_indexline ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ cp -r 20 tmp
+ cd tmp
+ mv patch tmp
+ echo 'Index: åäö' > patch
+ cat tmp >> patch
+ mv old åäö
+ mv new new.saved
+ $p < patch > /dev/null && diff åäö new.saved > /dev/null
+ report_np $? "nonascii_name_indexline"
+ cd ..
+ rm -r tmp
+}
+
+quoted_name ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ cp -r 20 tmp
+ cd tmp
+ cp old old.saved
+ mv old åäö
+ diff -u åäö new > patch-u
+ diff -c åäö new > patch-c
+ mv new new.saved
+ $p < patch-u > /dev/null && diff åäö new.saved > /dev/null
+ report_np $? "quoted_name -u"
+ cp old.saved åäö
+ $p < patch-c > /dev/null && diff åäö new.saved > /dev/null
+ report_np $? "quoted_name -c"
+ cd ..
+ rm -r tmp
+}
+
+quoted_name_indexline ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ cp -r 20 tmp
+ cd tmp
+ mv patch tmp
+ echo 'Index: "\303\245\303\244\303\266"' > patch
+ cat tmp >> patch
+ mv old åäö
+ mv new new.saved
+ $p < patch > /dev/null && diff åäö new.saved > /dev/null
+ report_np $? "quoted_name_indexline"
+ cd ..
+ rm -r tmp
+}
+
+quoted_name_diffline ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ cp -r 20 tmp
+ cd tmp
+ mv patch tmp
+ echo 'diff '\'' x x '\'' "\303\245\303\244\303\266" new' > patch
+ cat tmp >> patch
+ mv old åäö
+ mv new new.saved
+ $p < patch > /dev/null && diff åäö new.saved > /dev/null
+ report_np $? "quoted_name_diffline"
+ cd ..
+ rm -r tmp
+}
+
+quote_format ()
+{
+ if test -d tmp; then
+ rm -r tmp
+ fi
+ cp -r 20 tmp
+ cd tmp
+ mv patch tmp
+ cname='a\a\b\f\n\r\t\vbcd\x80\x80\123'
+ name="$(printf "${cname}")"
+ echo 'Index: "'"${cname}"'"' > patch
+ cat tmp >> patch
+ mv old "${name}"
+ mv new new.saved
+ $p < patch > /dev/null && diff "${name}" new.saved > /dev/null
+ report_np $? "quote_format"
+ cd ..
+ rm -r tmp
+}
+
+if test $# = 0; then
+ set reversed_q garbage dryrun_1 dryrun_2 dryrun_3 bflag dash_file det_file_1a det_file_1b \
+ det_file_2 det_file_3 det_file_1a_3 det_file_dl det_file_dl1 det_file_dl2 det_file_1a_dl \
+ det_file_dl_3 det_file_5 oflagless dflag diflag pflagless p0flag p1flag p2flag p1flag_slash \
+ pdflag multipatch multipatch_oflag reppatch reppatch_oflag reppatch_bflag multipatch_bflag \
+ rflag_uflagless ruflag rflagless dash_r dash_r_file dash_io dash_ri dash_o_file dash_rio \
+ dash_ro_file rej_dash_io rej_dash_o_file dash_o_append dash_o_truncate stdout_o_append \
+ bflag_dash_rio bflag_dash_ro_file bflag_dry bflag_oflagless symlink mode reppatch_ndef \
+ reppatch_def def_excl def_zero def_one def_excl_one rej_multipatch doflag dioflag piflag \
+ poflag pioflag pdiflag pdoflag pdioflag pdflag_absolute explicit_absolute pflag_excess \
+ pflag_excess_one pflag_file dflag_file pdflag_file nonascii_name nonascii_name_indexline \
+ quoted_name quoted_name_indexline quoted_name_diffline quote_format
+fi
+(
+for f in $@; do
+ $f
+done
+) | tee result2
+
+touch result1 result2
+cat result1 result2 > result
+! grep FAILED < result >/dev/null
+ret=$?
+rm result1 result2 result
+exit $ret