Philip Martin created SVN-4607:
----------------------------------
Summary: patch file missing a trailing newline removes a newline
when applied
Key: SVN-4607
URL: https://issues.apache.org/jira/browse/SVN-4607
Project: Subversion
Issue Type: Bug
Components: libsvn_client
Reporter: Philip Martin
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
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)