* git add -N vs. git stash
@ 2022-08-08 16:39 Uwe Kleine-König
2022-08-08 17:30 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2022-08-08 16:39 UTC (permalink / raw)
To: git; +Cc: Jakub Wilk
[-- Attachment #1: Type: text/plain, Size: 554 bytes --]
Hello,
somehow git stash doesn't understand the index after git add -N:
$ git version
git version 2.36.1
$ git init -q
$ echo foo > foo
$ git add foo
$ git commit -a -m .
[main (root-commit) 0e4b48cb4913] .
1 file changed, 1 insertion(+)
create mode 100644 foo
$ echo bar > bar
$ git add -N bar
$ git stash push
error: Entry 'bar' not uptodate. Cannot merge.
Cannot save the current worktree state
I'd say that's not a feature, is it?
I would have expected the last command to just remove bar from the
index.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: git add -N vs. git stash
2022-08-08 16:39 git add -N vs. git stash Uwe Kleine-König
@ 2022-08-08 17:30 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2022-08-08 17:30 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: git, Jakub Wilk
Uwe Kleine-König <uwe@kleine-koenig.org> writes:
> I'd say that's not a feature, is it?
I think that is a sign that "add -N" came much later than "stash",
and whoever added the former was not a heavy user of "stash" ;-)
As the state of the "tracked files in the working tree" and "staged
contents in the index" are both stored as tree objects, I think the
necessary fix would involve
- record the contents of the "intent-to-add" paths to the tree
object for the working tree.
- record the fact that the "intent-to-add" paths are "not in the
index yet" by removing them from the tree object for the index.
on the recording side (i.e. "stash create"), and then teach the
replay side (i.e. "stash apply") to pay attention to such strange
"exists in the tree for the working tree, but missing from the tree
for the index" paths and mark them with the "intent-to-add" bit.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-08 17:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-08 16:39 git add -N vs. git stash Uwe Kleine-König
2022-08-08 17:30 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).