git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 17, 2008, 09:12 UTC
Message-ID
<7vve1dcn0m.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LFD.1.10.0805131811540.3019@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 22 quoted lines
> 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.

Previous: Linus TorvaldsNext: Junio C Hamano
Message 10 of 12 in “builtin-apply: check for empty files when detecting creation patch”
  1. builtin-apply: check for empty files when detecting creation patchImre Deak, May 8, 2008
  2. Junio C HamanoMay 11, 2008
  3. Imre DeakMay 13, 2008
  4. Junio C HamanoMay 13, 2008
  5. Linus TorvaldsMay 13, 2008
  6. Junio C HamanoMay 13, 2008
  7. Linus TorvaldsMay 13, 2008
  8. Junio C HamanoMay 14, 2008
  9. Linus TorvaldsMay 14, 2008
  10. Junio C HamanoMay 17, 2008
  11. 1/2 builtin-apply: accept patch to an empty fileJunio C Hamano, May 17, 2008
  12. 2/2 builtin-apply: do not declare patch is creation when we do not know itJunio C Hamano, May 17, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.