summaryrefslogtreecommitdiff
path: root/recipes/wiggle/wiggle-0.6/004ExtractFix
blob: 8ab090992dfb5181ece10cc3447bd7717c533a50 (plain)
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
Status: ok

Fix off-by-one-error when extracting a merge file.

If a merge ended at EOF, --extract wouldn't interpret it properly.

 ----------- Diffstat output ------------
 ./extract.c |    8 ++++----
 ./p         |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff ./extract.c~current~ ./extract.c
--- ./extract.c~current~	2004-02-03 13:18:41.000000000 +1100
+++ ./extract.c	2004-02-03 13:18:55.000000000 +1100
@@ -207,7 +207,7 @@ int split_merge(struct stream f, struct 
 		lineno++;
 		switch(state) {
 		case 0:
-			if (len>8 &&
+			if (len>=8 &&
 			    strncmp(cp, "<<<<<<<", 7)==0 &&
 			    (cp[7] == ' ' || cp[7] == '\n')
 				) {
@@ -222,7 +222,7 @@ int split_merge(struct stream f, struct 
 			}
 			break;
 		case 1:
-			if (len>8 &&
+			if (len>=8 &&
 			    strncmp(cp, "|||||||", 7)==0 &&
 			    (cp[7] == ' ' || cp[7] == '\n')
 				) {
@@ -232,7 +232,7 @@ int split_merge(struct stream f, struct 
 				copyline(&r1, &cp, end);
 			break;
 		case 2:
-			if (len>8 &&
+			if (len>=8 &&
 			    strncmp(cp, "=======", 7)==0 &&
 			    (cp[7] == ' ' || cp[7] == '\n')
 				) {
@@ -242,7 +242,7 @@ int split_merge(struct stream f, struct 
 				copyline(&r2, &cp, end);
 			break;
 		case 3:
-			if (len>8 &&
+			if (len>=8 &&
 			    strncmp(cp, ">>>>>>>", 7)==0 &&
 			    (cp[7] == ' ' || cp[7] == '\n')
 				) {

diff ./p~current~ ./p
--- ./p~current~	2004-02-03 13:18:44.000000000 +1100
+++ ./p	2004-02-03 13:18:55.000000000 +1100
@@ -170,7 +170,7 @@ commit_one()
 {
 	rm -f "$1~current~"
 	mv "$1" "$1~current~"
-	cp "$1~current~" $1
+	cp -p "$1~current~" $1
 	chmod u+w $1
 }