Menu

#938 New Line Character Confuses "Generate Patch": LF vs CR+LF

open
nobody
5
2012-12-21
2005-07-18
Liisachan
No

This happens when File1 uses LF only for the new line
character (a la Unix),
and File2 uses CR+LF for the new line character (a la
Windows).

WinMerge is basically not confused by the difference of
new line characters.

However, Tool | Generate Patch... will report that
every single line is different just because the difference
of the new line characters.

Demo:

CR+LF.txt in the sample.zip attached is:
a
b
c
foo
d
e
f
g

LF-only.txt is:
a
b
c
bar
d
e
f
g

WinMerge detects only one different line--foo vs bar.
But if you generate a patch, the resulted diff file
says every lines are different just because the
difference of the new line characters.. (2340diff.txt
is the resulted diff file)

Using 2.3.4.0

Discussion

  • Liisachan

    Liisachan - 2005-07-18

    Demo & conf log

     
  • Kimmo Varis

    Kimmo Varis - 2005-07-26

    Logged In: YES
    user_id=631874

    There is another almost identical bug item:
    #1079184 generate patch does not use "ignore DOS/UNIX/Mac
    CR" differe
    https://sourceforge.net/tracker/index.php?func=detail&aid=1079184&group_id=13216&atid=113216

    I think that adding option for ignoring new-line differences
    would be good. I myself have to handle files with mixed
    new-line chars in daily basis so creating patches from them
    is a bit hard.

     
  • Kimmo Varis

    Kimmo Varis - 2005-07-31

    Logged In: YES
    user_id=631874

    Argh. I looked at implementing that EOL ignore option. But
    (of course) diffutils code hardcodes EOL for DOS type. Also,
    it doesn't seem to handle other EOLs anyway - I tried to
    create a patch between DOS original file and UNIX altered
    file. And it added zero bytes before EOL bytes.

    Also, I think we should use altered file EOL type for
    patches. Since patches are kind of scripts to alter files,
    so that is only way to produce correct results. Another
    possibility would be to add a EOL type selection to dialog.

    So implementing EOL ignore for patches is a lot of work.

     

Log in to post a comment.

MongoDB Logo MongoDB