Re: [PATCH] builtin-apply: check for empty files when detecting creation patch

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

 




On Tue, 13 May 2008, Junio C Hamano wrote:
> 
> So I think it is reasonable to use non-/dev/null-ness of first as a cue
> that it is not a creation patch.

I disagree.

The fact is, /dev/null means that for patches generated by GNU diff, but a 
lot of other systems you'll find that it means no such thing.

Look at CVS-generated patches, or SVN for that matter. The diffs look like 
this:

	Index: file
	===================================================================
	--- file (revision 0)
	+++ file (working copy)
	@@ -0,0 +1 @@
	+test

and there is no /dev/null there.

The thing is, git-apply is careful, and it's very much careful with 
respect to *knowing* that there are lots of different versions of "diff" 
floating around, and lots of different SCM systems that generate odd diff 
headers. We should absolutely NOT start expecting that diffs are only 
generated with GNU diff.

So non-/dev/null'ness means absolutely nothing. It means "don't know", and 
we should leave is_new and is_delete as -1.

		Linus
--
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