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

Re: git-apply fails on creating a new file, with both -p and --directory specified

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 8, 2009, 02:59 UTC
Message-ID
<7vk4wyqigf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<loom.20091207T222449-752@post.gmane.org>
James Vega <vega.james@gmail.com> writes:
> It looks like this may have introduced a bug when staging a file
> removal.  Here's an example git session showing the issue:
> <<snipped>>

Thanks for a report, but I cannot get the evidence that the said patch has anything to do with the issue you illustrated.

$ cat >patch0 <<\EOF
diff --git a/foo b/foo
deleted file mode 100644
index 257cc56..0000000
--- a/foo
+++ /dev/null
@@ -1 +0,0 @@
-foo
EOF
$ git apply --numstat patch0
0	1	foo
$ sed -e '/deleted file/d' patch0 | git apply --numstat
0	1	dev/null

The last one is showing the symptom in your message.  Git versions 1.4.0
and newer yield the same result, but 1.3.0 gives a funny message:

        ** warning: file dev/null becomes empty but is not deleted
        0       1       foo

So it appears that the bug is somewhere else not in that patch.
Previous: James VegaNext: Junio C Hamano
Message 4 of 14 in “git-apply fails on creating a new file, with both -p and --directory specified”
  1. Steven J. MurdochNov 23, 2009
  2. Junio C HamanoNov 25, 2009
  3. James VegaDec 7, 2009
  4. Junio C HamanoDec 8, 2009
  5. Junio C HamanoDec 8, 2009
  6. Jeff KingDec 8, 2009
  7. Jeff KingDec 8, 2009
  8. James VegaDec 8, 2009
  9. Junio C HamanoDec 8, 2009
  10. Jeff KingDec 8, 2009
  11. Junio C HamanoDec 8, 2009
  12. Junio C HamanoDec 8, 2009
  13. Jeff KingDec 8, 2009
  14. James VegaDec 8, 2009

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.