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

Re: svn commit: r40403 - trunk/subversion/libsvn_diff

From: Stefan Sperling <stsp_at_elego.de>
Date: Fri, 6 Nov 2009 19:14:46 +0100

On Fri, Nov 06, 2009 at 09:47:12AM -0800, Daniel Rall wrote:
> On Fri, Nov 6, 2009 at 9:38 AM, Branko ─îibej <brane_at_xbc.nu> wrote:
> > Daniel Rall wrote:
> > In a patch file, a backslash in the first column means "no newline at
> > end of file" -- the rest of the line is pure comment and *should* be
> > igmored, but that backslash tells you important things about the hunk's
> > context.
>
> So, any line starting with a backslash after a hunk should be
> discarded,

Thanks, I'll fix this.
I was under the impression that the string was part of the special
marker and was not supposed to be localised.
Quoting libsvn_diff/diff_file.c:

          SVN_ERR(svn_utf_cstring_from_utf8_ex2
                  (&out_str,
                   /* The string below is intentionally not marked for
                      translation: it's vital to correct operation of
                      the diff(1)/patch(1) program pair. */
                   APR_EOL_STR "\\ No newline at end of file" APR_EOL_STR,
                   baton->header_encoding, baton->pool));

But as Arfrever pointed out other implementations do localise it.
I checked the UNIX patch code and it only looks for the backslash, too.

> but it must also modify the last line in the hunk, removing
> the explicit newline that was part of the patch.

All newlines are already removed by svn_stream_readline().
That's why using svn patch to apply a patch which only changes newlines
is currently a no-op, as explained in the log message.

Stefan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2415174
Received on 2009-11-06 19:15:26 CET

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