git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* 'stash push' fails after 'add -N'
@ 2022-04-05  9:32 Maximilian Reichel
  0 siblings, 0 replies; only message in thread
From: Maximilian Reichel @ 2022-04-05  9:32 UTC (permalink / raw)
  To: git

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
Running the following commands:
```
#!/bin/bash
git init workDir
cd workDir
git commit -m first --allow-empty
touch a
git add --intent-to-add a
git stash push --include-untracked
```

What did you expect to happen? (Expected behavior)
I tried to stash my changes after adding a file with `git add --intent-to-add`.
I expected the stash operation to succeed.


What happened instead? (Actual behavior)
The stash operation fails with the following output:
```
error: Entry 'a' not uptodate. Cannot merge.
Cannot save the current worktree state
```
Also, I find the error message very confusing.

It seems inconsistent whether git considers files added with
`--intent-to-add` as tracked or untracked.
Running `git status` after the commands above will show "Changes not
staged for commit: new file: a".
If I run the following commands after the commands above:
```
touch b
git add b
git stash push -S
git stash pop --index
git rm -f b
```
`git status` will now report the file `a` as untracked.

What's different between what you expected and what actually happened?
I expected `git stash push` to succeed instead of failing.

Anything else you want to add:
I tested this on git 2.35.1 and 2.21.0, which are both affected.

[System Info]
git version:
git version 2.35.1
cpu: x86_64
built from commit: 4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64
compiler info: gnuc: 10.2
libc info: glibc: 2.31
$SHELL (typically, interactive shell): <unset>


[Enabled Hooks]
not run from a git repository - no hooks to show

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-05 11:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05  9:32 'stash push' fails after 'add -N' Maximilian Reichel

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).