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

[BUG] apply -N deletes the index

From
Raymond E. Pasco <ray@ameretat.dev>
Date
May 18, 2021, 13:59 UTC
Message-ID
<CBGFBF8EDCPS.LNG4VOVFVR6M@ziyou.local>

Expected behavior: git apply -N foo.patch applies a patch to the worktree, additionally adding 'new file' entries in the patch to the index as intent-to-add entries.

Actual behavior: git apply -N foo.patch overwrites the entire index, so that after the command it *only* contains the intent-to-add entries added by the patch, and nothing else. (It still applies properly to the worktree.)

I am looking at apply.c to figure out why this happens, but thought a report to the list was warranted; any thoughts from someone more familiar with this machinery would be helpful.

I went back in the history and this seems to have happened since the feature was first added (ac997db0, Merge branch 'nd/diff-apply-ita').

Message 1 of 1 in “[BUG] apply -N deletes the index”
  1. Raymond E. PascoMay 18, 2021

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.