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

Re: cr, lf on merge ... implement or use gnu diff option?

From: Branko Čibej <brane_at_xbc.nu>
Date: 2002-11-12 17:59:14 CET

All right, this is a pretty standard problem if you have files with
mixed line endings. To answer your original question: no, diff/diff3 do
not, in general, handle this situation graceully.

Now, please explain why you don't set the property svn:eol-style to
'native' on text files? If you do that, Subversion will automagically
convert the end-of-line markers to whatever is appropriate to the client
system, and leave them in a canonical form in the repository.

Your recipe for adding new text files should be:
$ svn add foo
$ svn propset svn:eol-style native foo
$ svn commit ...

You can do the same (without the add) to fix your local files, but you
should convert all line endings to the local style first.

solo turn wrote:

>file test.txt created on two plattforms. the lines have "unix", or
>"win" in them, depending where they were created, i.e. lf as end for
>unix, and cr-lf for win (they are in the repository that way):
>
>then you modify the working copy.
>
>file "test.txt" saved one time as type "unix"
>C:\tmp\t>svn diff test.txt
>Index: test.txt
>====================================
>--- test.txt (revision 14)
>+++ test.txt (working copy)
>@@ -1,4 +1,4 @@
>-2nd line, win
>+2nd line, win
> 3nd line, unix
> 4nd line, unix
>-1st line, win
>+1st line, win
>
>file "test.txt" saved one time as type "win"
>C:\tmp\t>svn diff test.txt
>Index: test.txt
>====================================
>--- test.txt (revision 14)
>+++ test.txt (working copy)
>@@ -1,4 +1,4 @@
> 2nd line, win
>-3nd line, unix
>-4nd line, unix
>+3nd line, unix
>+4nd line, unix
> 1st line, win
>
>
>the questions were:
>why the original line endings are stored in the repository (win, unix
>mixed together), does svn not know the difference between "text" and
>"binary"?
>
>and IF they are stored the way they are stored, can one get rid of
>diffs aware of line-endings by specifying an option somewhere, or
>somebody has to program something to reach this?
>
>the should-be result would be something like (display NO difference):
>C:\tmp\t>diff --strip-trailing-cr tdos.txt tu.txt
>
>C:\tmp\t>
>
>perforce handles that via saying: unix, max-os-X use lf, so we in the
>repository use linefeed. for macos you have to tell poeple what to
>do.
>
>for win, the cr are striped away when transferring to the repository,
>and also when doing diffs.
>
>(and sorry, i can't reproduce the two-lines get one line in a merge
>any more .... but it had been some variation of the above).
>
>

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 12 18:00:14 2002

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

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