Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
This problem is present in the 1.8 and 1.9 releases but has already been fixed in 1.10.
A patch file that is missing a trailing newline can remove a newline elsewhere in the file:
svnadmin create repo
svnmucc -mm -U file://`pwd`/repo \
put <(printf "a\nb\nc\nd\ne\nf\n") f
svn co file://`pwd`/repo wc
printf "x\na\nb\nc\nd\ne\nf\n" > wc/f
(cd wc && svn diff) > patch.txt
svn revert wc/f
The patch inserts one line:
$ cat patch.txt
Index: f
===================================================================
— f (revision 1)
+++ f (working copy)
@@ -1,3 +1,4 @@
+x
a
b
c
Strip the final newline from the patch:
$ dd bs=1 count=144 if=patch.txt of=patch-noeol.txt
When applied this patch still adds a line but is also removes a newline in a different location:
$ svn patch patch-noeol.txt wc
U wc/f
$ svn diff wc
Index: wc/f
===================================================================
— wc/f (revision 1)
+++ wc/f (working copy)
@@ -1,6 +1,6 @@
+x
a
b
-c
-d
+cd
e
f