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

Re: [PATCH v2] git-apply.txt: update descriptions of --cached, --index

From
Raymond E. Pasco <ray@ameretat.dev>
Date
Aug 21, 2020, 00:26 UTC
Message-ID
<C528Y3DXYRMW.22FBYW4FHMALJ@ziyou.local>
In-Reply-To
<xmqq4kowc1ls.fsf@gitster.c.googlers.com>
On Thu Aug 20, 2020 at 7:57 PM EDT, Junio C Hamano wrote:
Show 5 quoted lines
> I do not see why we want to stress the last part after ", even if".
> The safety mechanism insists on the working tree file and the index
> entry to be identical, and the location where in the file the
> difference is, is irrelevant, whether it is outside the area the
> incoming patch touches, or it overlaps.

It's because this is the confusing part of the option - it's easy to grasp "apply the patch to both the working copy and the index", but that's not exactly what the option does, it applies only in the case of identical preimages (and therefore, identical postimages). If you do want to apply it to both the working copy and the index, which aren't identical (e.g., you're a heavy worktree mangler and "add -p" user, like me), this points you towards invoking it twice, once with no option and once with "--cached".

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “git-apply.txt: update descriptions of --cached, --index”
  1. git-apply.txt: update descriptions of --cached, --indexRaymond E. Pasco, Aug 20, 2020
  2. Junio C HamanoAug 20, 2020
  3. Raymond E. PascoAug 21, 2020
  4. Junio C HamanoAug 21, 2020

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.