From: René Scharfe Date: Wed, 13 Aug 2008 21:52:58 GMT Subject: Re: Why doesn't git-apply remove empty file Message-ID: <48A357BA.8060003@lsrfire.ath.cx> In-Reply-To: <38b2ab8a0808130048t506dbb7ah1d6fcd6bd4f3c90c@mail.gmail.com> Francis Moreau schrieb: > $ mkdir a b > $ date > a/f > $ diff -Nurp a/f b/f > --- a/f 2008-08-13 09:27:29.000000000 +0200 > +++ b/f 1970-01-01 01:00:00.000000000 +0100 > @@ -1 +0,0 @@ > -Wed Aug 13 09:27:29 CEST 2008 > > So '/dev/null' doesn't appear here. I think patch(1) uses the date of > b/f for removing > the file. > > If we keep going on: > > $ diff -Nurp a b > test.patch > $ ( cd a && git apply ../test.patch ) > $ ls a > f > $ cat a/f > $ > > of course patch(1) does remove the file. I bet you are using GNU patch. It removes files that are empty after patching and you need to specify --posix to make it keep empty files. Larry Wall's original version of patch keeps empty files by default and you need to use the option option -E (or --remove-empty-files) to make it remove them. René