# 'stash push' fails after 'add -N'

1 messages from 2022-04-05 to 2022-04-05. Participants: Maximilian Reichel.
Thread: https://gitlist.dev/t/57664

## Maximilian Reichel, 2022-04-05 09:32

Subject: 'stash push' fails after 'add -N'
Message-ID: <1E62EF4D-1D9C-494F-832D-EDE7A10EC665@icloud.com>
URL: https://gitlist.dev/e/1E62EF4D-1D9C-494F-832D-EDE7A10EC665%40icloud.com

```
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
```
