git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Imre Deak <imre.deak@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] builtin-apply: check for empty files when detecting creation patch
Date: Sat, 17 May 2008 02:12:25 -0700	[thread overview]
Message-ID: <7vve1dcn0m.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.1.10.0805131811540.3019@woody.linux-foundation.org> (Linus Torvalds's message of "Tue, 13 May 2008 18:14:32 -0700 (PDT)")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Tue, 13 May 2008, Junio C Hamano wrote:
>> 
>> With the change to remove the whole block, all tests still passes, and a
>> limited test with this:
>> 
>>         --- empty	2008-05-13 16:56:57.000000000 -0700
>>         +++ empty.1	2008-05-13 16:57:07.000000000 -0700
>>         @@ -0,0 +1 @@
>>         +foo
>> 
>> to update an originally empty file "empty" also seems to work.
>> 
>> However, with this change, it no longer allows you to accept such a patch
>> and treat it as a creation of "empty".  Instead we barf with "error:
>> empty: No such file or directory", if you do not have an empty "empty"
>> file in the work tree when you run "git apply" on the above patch.
>
> Ok, that's a bug. It should *not* require that existing empty file, since 
> "is_new" is -1. That's what -1 means: we don't know if it is new or not.
>
> So I think your patch is correct, but we need to fix the thing that barfs 
> to not barf if we don't know the status of "is_new"

Sorry for taking some time to follow this through (I've been busy with day
job).  Two patches follow this message to address this issue.

  reply	other threads:[~2008-05-17  9:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08 14:39 [PATCH] builtin-apply: check for empty files when detecting creation patch Imre Deak
2008-05-11  2:36 ` Junio C Hamano
2008-05-13 20:16   ` Imre Deak
2008-05-13 21:48     ` Junio C Hamano
2008-05-13 22:24       ` Linus Torvalds
2008-05-13 22:34         ` Junio C Hamano
2008-05-13 22:58           ` Linus Torvalds
2008-05-14  0:13             ` Junio C Hamano
2008-05-14  1:14               ` Linus Torvalds
2008-05-17  9:12                 ` Junio C Hamano [this message]
2008-05-17  9:18                   ` [PATCH 1/2] builtin-apply: accept patch to an empty file Junio C Hamano
2008-05-17  9:19                   ` [PATCH 2/2] builtin-apply: do not declare patch is creation when we do not know it Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vve1dcn0m.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=imre.deak@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).