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

Re: git-apply working on an index with smudged entries

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 15, 2018, 00:40 UTC
Message-ID
<xmqqzht7bp0o.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAENte7hRCk+3E+C4LYOjTzQKdqE1wN1=HX7YkR72H+HD-=mj5g@mail.gmail.com>
Christian Halstrick <christian.halstrick@gmail.com> writes:
> Question:
> - is this because the index which jgit created is so corrupt that only
> special commands
> like "git status" can repair it?
No.
> - or is "git apply" not trying hard enough to consume a index with
> smudged entries
No.

Lower level "plumbing" commands like "git apply" want to see the cached stat information in the index refreshed before they are called, instead of having to refresh the index themselves before starting to work, for performance reasons. Higher level "Porcelain" commands like "git status" on the other hand refreshes the index before they start to work.

What you are seeing is a combination of
 * JGit not running its equivalent of "git update-index --refresh"
   before finishing and leaving the index file for you to look at.
 * "git status" running an equivalent of "git update-index --refresh"
   internally.
 * "git apply" not running "update-index --refresh" itself and
   instead expecting somebody else to have done so in the sequence
   of commands that it is a part of.
The latter two is working perfectly as designed.

I do not know what JGit wanted to do to leave the index in that state, so I cannot judge if that is a reasonable thing to do or JGit needs tobe fixed.

Previous: Christian Halstrick
Message 2 of 2 in “git-apply working on an index with smudged entries”
  1. Christian HalstrickDec 14, 2018
  2. Junio C HamanoDec 15, 2018

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.