Thread (1 message) 1 message, 1 author, 2020-10-18

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

From: Junio C Hamano <hidden>
Date: 2020-10-18 20:07:31

Phillip Wood [off-list ref] writes:
quoted
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.
If a user runs `add -N file` then if they run `git reset -p` (which
runs `git diff-index --cached HEAD`) it will ask them if they want to
remove `file` from the index. If `diff-index --cached` hid i-t-a
entries we'd lose that or have to get the i-t-a entries another
way. Having said that it does seem strange for `diff-index --cached`
to be showing i-t-a entries. Perhaps `diff-index --cached` should
default to --ita-invisible-in-index?
It probably is a good idea to consider if the implementation of `git
reset -p` is doing a sensible thing, or relying on a buggy behaviour
of "diff-index --cached" (worse yet, broken "diff-index --cached" to
suit its needs) and see if it can be written differently.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help