[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: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Tue, 16 Oct 2012 10:52:01 +0200

On Mon, Oct 15, 2012 at 9:12 PM, cz02 <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
>
> I tried to get this verified on the users group but only found out that the
> issue does not exist on Unix - might be a Windows only bug.

I can't reproduce this. I'm on Windows 7 sp1 too, with svn 1.7.7 (SlikSVN).

I tried two variations: one where svn:eol-style=native would be set
automatically by my normal auto-props settings. And one where I
disable auto-props before adding the files. Neither of the variations
had the problem that you observed. So I'm not sure what could be
different on your machine vs. my setup.

Here is a transcript of what I did (in cmd.exe):
[[[
### First attempt, with my regular auto-props setting
C:\Temp\testje>svnadmin create repos

C:\Temp\testje>svn co file:///C:/Temp/testje/repos wc
Checked out revision 0.

C:\Temp\testje>cd wc

C:\Temp\testje\wc>copy ..\*.txt .
..\aaa.txt
..\bbb.txt
        2 file(s) copied.

C:\Temp\testje\wc>dir
 Volume in drive C is Default
 Volume Serial Number is A65F-CF5B

 Directory of C:\Temp\testje\wc

16-10-2012 10:33 <DIR> .
16-10-2012 10:33 <DIR> ..
11-10-2012 12:12 52 aaa.txt
11-10-2012 12:12 54 bbb.txt
               2 File(s) 106 bytes
               2 Dir(s) 156.481.060.864 bytes free

C:\Temp\testje\wc>svn add aaa.txt bbb.txt
A aaa.txt
A bbb.txt

C:\Temp\testje\wc>svn pl -v aaa.txt
Properties on 'aaa.txt':
  svn:eol-style
    native

C:\Temp\testje\wc>svn commit -m"adding files"
Adding aaa.txt
Adding bbb.txt
Transmitting file data ..
Committed revision 1.

C:\Temp\testje\wc>svn up
Updating '.':
At revision 1.

C:\Temp\testje\wc>svn st

C:\Temp\testje\wc>cat ..\p.patch
Index: aaa.txt
===================================================================
--- aaa.txt (revision 912)
+++ aaa.txt (working copy)
@@ -2,6 +2,6 @@
 {
   void bar()
   {
- //dummy
+ //more
   }
 }
\ No newline at end of file
Index: bbb.txt
===================================================================
--- bbb.txt (revision 912)
+++ bbb.txt (working copy)
@@ -2,6 +2,6 @@
 {
   void bar()
   {
- //dummy
+ //more
   }
 }

C:\Temp\testje\wc>svn patch ..\p.patch
U aaa.txt
U bbb.txt

C:\Temp\testje\wc>svn revert *.txt
Reverted 'aaa.txt'
Reverted 'bbb.txt'

C:\Temp\testje\wc>svn patch ..\p2.patch
U aaa.txt
U bbb.txt

C:\Temp\testje\wc>svn revert *.txt
Reverted 'aaa.txt'
Reverted 'bbb.txt'

### Second attempt, disabling auto-props
C:\Temp\testje\wc>cd ..

C:\Temp\testje>svnadmin create repos2

C:\Temp\testje>svn co file:///C:/Temp/testje/repos2 wc2
Checked out revision 0.

C:\Temp\testje>cd wc2

C:\Temp\testje\wc2>copy ..\*.txt .
..\aaa.txt
..\bbb.txt
        2 file(s) copied.

C:\Temp\testje\wc2>svn add --config-option
config:miscellany:enable-auto-props=no aaa.txt bbb.txt
A aaa.txt
A bbb.txt

C:\Temp\testje\wc2>svn pl -v aaa.txt

C:\Temp\testje\wc2>svn commit -m"adding files"
Adding aaa.txt
Adding bbb.txt
Transmitting file data ..
Committed revision 1.

C:\Temp\testje\wc2>svn up
Updating '.':
At revision 1.

C:\Temp\testje\wc2>dir
 Volume in drive C is Default
 Volume Serial Number is A65F-CF5B

 Directory of C:\Temp\testje\wc2

16-10-2012 10:40 <DIR> .
16-10-2012 10:40 <DIR> ..
11-10-2012 12:12 52 aaa.txt
11-10-2012 12:12 54 bbb.txt
               2 File(s) 106 bytes
               2 Dir(s) 157.020.934.144 bytes free

C:\Temp\testje\wc2>svn patch ..\p.patch
U aaa.txt
U bbb.txt

C:\Temp\testje\wc2>svn revert *.txt
Reverted 'aaa.txt'
Reverted 'bbb.txt'

C:\Temp\testje\wc2>svn patch ..\p2.patch
U aaa.txt
U bbb.txt
]]]

-- 
Johan
Received on 2012-10-16 10:52:58 CEST

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