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

Re: "svn patch" and the TAB character

From: Stefan Sperling <stsp_at_elego.de>
Date: Sat, 14 Dec 2019 12:13:07 +0100

On Sat, Dec 14, 2019 at 10:59:01AM +0000, Daniel Shahaf wrote:
> Doug Robinson wrote on Fri, 13 Dec 2019 21:59 +00:00:
> > If I [...] edit that patch file using an editor with settings that replace the TAB
> > with a "proper" number of SPACE characters,
>
> Don't do that. If the context lines start with tabs (ignoring the first
> column), they would be corrupted and the patch wouldn't apply — and even
> if it did apply, the indentation would be off-by-one or off-by-eight. However:
>
> > $ svn patch ../n.txt
> > Skipped missing target: 'TheFile (revision 18)'
> > Summary of conflicts:
> > Skipped paths: 1
> >
> > (the TAB was between "TheFile" and "(revision...)".
>
> Fixing this specific case would be helpful to projects that use spaces-
> only indentation where the unidiff got tabs-to-spaces'ed at some point
> (e.g., some terminal emulators do this). I'm not opposed to it, though
> I don't think it's high priority either. Does anyone have an algorithm
> to propose? (An algorithm for deriving the name of a file to patch from
> the +++, ---, and "Index:" lines.)
>
> Cheers,
>
> Daniel

'svn patch' already behaves like regular patch, i.e. it assumes the whole line
denotes a file name if no TAB can be found.

The problem is that svn diff's revision number marker " (revision XY)" must
be separated by a TAB. Otherwise it becomes part of the file name.
Perhaps --patch-compatible should omit those markers?
Received on 2019-12-14 12:13:24 CET

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.