[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: SVN patch IGNORES file without newline at end of file

From: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 11 Oct 2012 21:14:15 +0200

On Thu, Oct 11, 2012 at 12:22:51PM +0200, cz02_at_cdak.net wrote:
> Please verify this bug report:
>
> I have two identical files aaa.txt and bbb.txt except that aaa.txt
> has no "newline at end of file".
>
> When applying a patch (created with svn diff > p.patch) my
> modifications for aaa.txt are simply ignored with no error or
> warning!
>
> >svn patch p.patch
> U bbb.txt
>
> If I remove the line "\ No newline at end of file" from the patch
> file and apply it again (after reverting), everything works as
> expected:
>
> >svn patch p2.patch
> U aaa.txt
> U bbb.txt
>
> To reproduce simply create an empty repository and add aaa.txt and
> bbb.txt then try to apply the patches.
> Sample files attached.
>
> OS: Windows 7 sp1
> svn, version 1.7.7 (r1393599) - by SilkSVN
> compiled Oct 8 2012, 10:42:55

Thanks for your report.

I cannot reproduce this problem on unix with the files you've provided.
Both patches apply find (tested both svn from trunk and 1.7.6.
I don't have a 1.7.7 build handy right now, so I cannot test that,
but I suspect that trunk should have the same problem if it exists.

Maybe this bug only happens on Windows?

Do you have any svn:eol-style properties set on these files?
If so, what are the property values? If not, does adding an
svn:eol-style property fix this problem?

Here's my test run, everything works as expected. Not showing the
steps where I'm adding the example files to version control.

$ svn status
$ ls
aaa.txt bbb.txt
$ cat aaa.txt
class foo
{
  void bar()
  {
    //dummy
  }
$ cat bbb.txt
class foo
{
  void bar()
  {
    //dummy
  }
}
$ svn patch ../p.patch
U aaa.txt
U bbb.txt
$ svn diff
Index: aaa.txt
===================================================================
--- aaa.txt (revision 1)
+++ aaa.txt (working copy)
@@ -2,6 +2,6 @@
 {
   void bar()
   {
- //dummy
+ //more
   }
 }
\ No newline at end of file
Index: bbb.txt
===================================================================
--- bbb.txt (revision 1)
+++ bbb.txt (working copy)
@@ -2,6 +2,6 @@
 {
   void bar()
   {
- //dummy
+ //more
   }
 }
$ svn revert aaa.txt bbb.txt
Reverted 'aaa.txt'
Reverted 'bbb.txt'
$ svn patch ../p2.patch
U aaa.txt
U bbb.txt
$ svn diff
Index: aaa.txt
===================================================================
--- aaa.txt (revision 1)
+++ aaa.txt (working copy)
@@ -2,6 +2,6 @@
 {
   void bar()
   {
- //dummy
+ //more
   }
-}
\ No newline at end of file
+}
Index: bbb.txt
===================================================================
--- bbb.txt (revision 1)
+++ bbb.txt (working copy)
@@ -2,6 +2,6 @@
 {
   void bar()
   {
- //dummy
+ //more
   }
 }
Received on 2012-10-11 21:15:08 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.