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

bug: diff adding newline at end of file when changing lines

From: Avalon <third-chance_at_gmx.de>
Date: 2007-02-08 09:27:52 CET

>> i have a problem using "diff" of TortoiseSVN and asked on the
>> developers mailing list. Since no one responds their i thought about
>> sending it to the users mailing list.
>>
>> I have local modifications in a text file and look at the diff with
>> TortoiseSVN. Then i select one modified line and choose "Use this
>> text block" and save the file.
>>
>> I would expect that only the selected line should change, but
>> additionally the saved file now has a newline appended at the end of
>> the file.
>>
>> Is this a known bug or did i make something wrong?
>> Can someone reproduce this problem?
>
> Bug confirmed with 1.4.3 and trunk.
>
> I had a look at this before because I also had this problem. If I
> recall correctly problem is that the internally used method
> CFile::ReadString cannot destinguish between a file ending with
> "xxxx\r\n" and "xxxx". In both cases it only reads "xxxx". When
> writting the file TortoiseMerge always adds a newline to the end of
> the line and this results in the newline being added at the end of
> the file.

> Workaround: make sure all your files end with a newline - not the
> perfect solution :-(

Thank you for your confirmation - glad that it is not my fault ;-)

I do understand the problem which originates in the use of the specific
function CStdioFile::ReadString. But it should be possible to achieve
this by using another function to read the file.
Sometimes it is not possible to add the extra newline to a source code
file - i hope this behavior will be changed in tortoise. Should i fill a
bug request about that?

Another problem which also arises by using CStdioFile::ReadString is
described in question 7.13 at http://www.mpdvc.de/html.htm#Q71
This could result in errors when read a file with specific length in the
last line! This could be work round in the file StdioFileT of tortoise
by using the hack described on the website.

Best regards,
Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: users-help@tortoisesvn.tigris.org
Received on Thu Feb 8 10:05:10 2007

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

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