Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jan 2013 01:06:46 -0600
From:      Scot Hetzel <swhetzel@gmail.com>
To:        Stephen Montgomery-Smith <stephen@missouri.edu>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: How to apply an svn diff
Message-ID:  <CACdU%2Bf-OVSoZeNeoCrKrXyvgP=inKbV99BU59M9Bjstt%2Br7Mow@mail.gmail.com>
In-Reply-To: <50ECAC97.2060202@missouri.edu>
References:  <AF0B8EAAB094D6053B4EBC15@utd71538.campus.ad.utdallas.edu> <50EC9452.4050604@FreeBSD.org> <50ECAC97.2060202@missouri.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 8, 2013 at 5:32 PM, Stephen Montgomery-Smith
<stephen@missouri.edu> wrote:
> While we are on the subject of patch, has anyone else noticed the
> following annoyance?
>
> Suppose you create a patch against a non-existent file (using diff
> - -N), and let's suppose the old file is dir-orig/xxx, and the new file
> is dir/xxx.
>
> Then if I apply the patch to dir, and dir-orig doesn't exist, then
> patch issues all kinds of horrible error messages, and the new file is
> installed in the current directory rather than dir.
>
> I'm not sure if it is a bug or a feature.  But it has bitten me more
> than once.
>
According to the man page for patch(1):

"not specifying -p at all just gives you "blurfl.c", unless all of the
directories in the leading path (u/howard/src/blurfl) exist and that
path is relative, in which case you get the entire  pathname
unmodified."

So to have patch put the new files in the correct locations use:

patch -E -p0 < patchfile

Note: -E removes empty files.

Scot
-- 
DISCLAIMER:

No electrons were maimed while sending this message. Only slightly bruised.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACdU%2Bf-OVSoZeNeoCrKrXyvgP=inKbV99BU59M9Bjstt%2Br7Mow>