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

Re: Why does git diff-index show intent-to-add file as "Added"?

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 27, 2020, 20:06 UTC
Message-ID
<xmqqsg9zbfhy.fsf@gitster.c.googlers.com>
In-Reply-To
<20201027120943.skmx6c3crbtu335o@yadavpratyush.com>
Pratyush Yadav <me@yadavpratyush.com> writes:
Show 14 quoted lines
> It is `git diff-index --cached HEAD`.
>  
>> What should happen in "diff-index --cached HEAD", I offhand do not
>> know.  "diff-index --cached HEAD" is a request to compare two trees,
>> i.e. the tree that _would_ be produced if you wrote the index out as
>> a tree (i.e. "git write-tree") right now, and the tree of HEAD.  So
>> I think it may be sensible for the command to behave as if the i-t-a
>> path does not even exist in the index when it is run with "--cached";
>> I may be missing some subtleties that require us to do something
>> different, but that is what I would think.
>
> This is what I think too. Can we then treat this as a bug, and work on 
> fixing it? Does any subsystem expert have any comments and/or provide 
> extra context?

I do not think Phillip considers himself an expert in this area, but what he pointed out in the thread

    http://lore.kernel.org/git/xmqqo8kz70xv.fsf@gitster.c.googlers.com/
is worth listening to.
Previous: Pratyush Yadav
Message 6 of 6 in “Why does git diff-index show intent-to-add file as "Added"?”
  1. Pratyush YadavOct 17, 2020
  2. Junio C HamanoOct 17, 2020
  3. Phillip WoodOct 18, 2020
  4. Junio C HamanoOct 18, 2020
  5. Pratyush YadavOct 27, 2020
  6. Junio C HamanoOct 27, 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.