M cmd/mkfile => cmd/mkfile +1 -0
@@ 4,6 4,7 @@ TEST=\
cpp\
date\
git\
+ patch\
test\
<../regress
A cmd/patch/basic.expected => cmd/patch/basic.expected +100 -0
A cmd/patch/basic.in => cmd/patch/basic.in +93 -0
A cmd/patch/basic.patch => cmd/patch/basic.patch +42 -0
@@ 0,0 1,42 @@
+--- basic.in
++++ basic.out
+@@ -1,3 +1,5 @@
++1
++2
+ 3
+ 4
+ 5
+@@ -10,8 +12,8 @@
+ 12
+ 13
+ 14
+-13
+-12
++15
++16
+ 17
+ 18
+ 19
+@@ -35,6 +37,8 @@
+ 37
+ 38
+ 39
++40
++41
+ 42
+ 43
+ 44
+@@ -80,6 +84,7 @@
+ 84
+ 85
+ 86
++87
+ 88
+ 89
+ 90
+@@ -91,3 +96,5 @@
+ 96
+ 97
+ 98
++99
++100
A cmd/patch/create.expected => cmd/patch/create.expected +12 -0
A cmd/patch/create.patch => cmd/patch/create.patch +15 -0
@@ 0,0 1,15 @@
+--- /dev/null
++++ create.out
+@@ -1,0 +1,12 @@
++1
++2
++3
++4
++5
++6
++7
++8
++9
++10
++11
++12
A cmd/patch/delete.expected => cmd/patch/delete.expected +10 -0
A cmd/patch/delete.patch => cmd/patch/delete.patch +15 -0
@@ 0,0 1,15 @@
+--- delete.out
++++ /dev/null
+@@ -1,12 +1,0 @@
+-1
+-2
+-3
+-4
+-5
+-6
+-7
+-8
+-9
+-10
+-11
+-12
A => +100 -0
@@ 0,0 1,100 @@
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
A => +93 -0
@@ 0,0 1,93 @@
3
4
5
6
7
8
9
10
11
12
13
14
13
12
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
88
89
90
91
92
93
94
95
96
97
98
A => +54 -0
@@ 0,0 1,54 @@
diff should handle headers just fine, so
this file contains a few lines of header
and footer, with a couple of false starts,
consisting of lines starting with
--- some words
but no immediately following
+++ words
lines
--- header.in
+++ header.out
@@ -1,3 +1,5 @@
+1
+2
3
4
5
@@ -10,8 +12,8 @@
12
13
14
-13
-12
+15
+16
17
18
19
@@ -35,6 +37,8 @@
37
38
39
+40
+41
42
43
44
@@ -80,6 +84,7 @@
84
85
86
+87
88
89
90
@@ -91,3 +96,5 @@
96
97
98
+99
+100
-- signature footer: should not get picked up
and here is the footer that should
also be ignored.
A cmd/patch/mkfile => cmd/patch/mkfile +5 -0
@@ 0,0 1,5 @@
+</$objtype/mkfile
+
+TEST=patch
+
+<../../regress
A cmd/patch/multifile.patch => cmd/patch/multifile.patch +89 -0
@@ 0,0 1,89 @@
+--- multifile2.in
++++ multifile2.out
+@@ -1,21 +1,19 @@
+-77777
+ 77778
+ 77779
+ 77780
+ 77781
+ 77782
+-77783
+-77784
+-77785
+-77786
+-77787
+-77788
+ 77789
++77788
++77787
++77786
++77785
++77784
++77783
+ 77790
+ 77791
+ 77792
+ 77793
+ 77794
+-77795
+ 77796
+ 77797
+
+of course, each patch can have its own comment
+lines mixed in, so we should handle these.
+--- multifile1.in
++++ multifile1.out
+@@ -14,16 +14,6 @@
+ 12
+ 17
+ 18
+-19
+-20
+-21
+-22
+-23
+-24
+-25
+-26
+-27
+-28
+ 29
+ 30
+ 31
+@@ -32,20 +22,6 @@
+ 34
+ 35
+ 36
+-37
+-38
+-39
+-42
+-43
+-44
+-45
+-46
+-47
+-48
+-49
+-50
+-51
+-52
+ 53
+ 54
+ 55
+@@ -73,11 +49,11 @@
+ 77
+ 78
+ 79
+-80
+-81
+-82
+-83
+ 84
++83
++82
++81
++80
+ 85
+ 86
+ 88
A cmd/patch/multifile1.expected => cmd/patch/multifile1.expected +69 -0
A cmd/patch/multifile1.in => cmd/patch/multifile1.in +93 -0
A cmd/patch/multifile2.expected => cmd/patch/multifile2.expected +19 -0
@@ 0,0 1,19 @@
+77778
+77779
+77780
+77781
+77782
+77789
+77788
+77787
+77786
+77785
+77784
+77783
+77790
+77791
+77792
+77793
+77794
+77796
+77797
A cmd/patch/multifile2.in => cmd/patch/multifile2.in +21 -0
@@ 0,0 1,21 @@
+77777
+77778
+77779
+77780
+77781
+77782
+77783
+77784
+77785
+77786
+77787
+77788
+77789
+77790
+77791
+77792
+77793
+77794
+77795
+77796
+77797
A cmd/patch/nop.expected => cmd/patch/nop.expected +10 -0
A cmd/patch/patch.rc => cmd/patch/patch.rc +31 -0
@@ 0,0 1,31 @@
+#!/bin/rc -e
+
+fn check{
+ if(! cmp $1 $2){
+ >[2=1] echo fail: $1 $2
+ >[2=1] diff -u $1 $2
+ exit mismatch
+ }
+ status=()
+}
+
+fn checkpatch{
+ rm -f $1.out
+ patch $1.patch
+ check $1.out $1.expected
+}
+
+checkpatch basic
+checkpatch header
+checkpatch create
+
+seq 12 > delete.out
+patch delete.patch
+test ! -f delete.out
+
+rm -f multifile^(1 2)^.out
+patch multifile.patch
+check multifile1.out multifile1.expected
+check multifile2.out multifile2.expected
+
+status=()