Re: Why doesn't git-apply remove empty file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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é
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux