{"thread":{"id":"57664","subject":"'stash push' fails after 'add -N'","startedAt":"2022-04-05T09:53:34Z","lastAt":"2022-04-05T09:53:34Z","messageCount":1,"participants":["Maximilian Reichel"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"453108","messageId":"1E62EF4D-1D9C-494F-832D-EDE7A10EC665@icloud.com","threadId":"57664","inReplyTo":null,"subject":"'stash push' fails after 'add -N'","fromName":"Maximilian Reichel","fromEmail":"reichemn@icloud.com","sentAt":"2022-04-05T09:32:19Z","receivedAt":"2022-04-05T09:53:34Z","isPatch":false,"sender":{"key":"reichemn@icloud.com","avatar":null},"body":"Thank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\nRunning the following commands:\n```\n#!/bin/bash\ngit init workDir\ncd workDir\ngit commit -m first --allow-empty\ntouch a\ngit add --intent-to-add a\ngit stash push --include-untracked\n```\n\nWhat did you expect to happen? (Expected behavior)\nI tried to stash my changes after adding a file with `git add --intent-to-add`.\nI expected the stash operation to succeed.\n\n\nWhat happened instead? (Actual behavior)\nThe stash operation fails with the following output:\n```\nerror: Entry 'a' not uptodate. Cannot merge.\nCannot save the current worktree state\n```\nAlso, I find the error message very confusing.\n\nIt seems inconsistent whether git considers files added with\n`--intent-to-add` as tracked or untracked.\nRunning `git status` after the commands above will show \"Changes not\nstaged for commit: new file: a\".\nIf I run the following commands after the commands above:\n```\ntouch b\ngit add b\ngit stash push -S\ngit stash pop --index\ngit rm -f b\n```\n`git status` will now report the file `a` as untracked.\n\nWhat's different between what you expected and what actually happened?\nI expected `git stash push` to succeed instead of failing.\n\nAnything else you want to add:\nI tested this on git 2.35.1 and 2.21.0, which are both affected.\n\n[System Info]\ngit version:\ngit version 2.35.1\ncpu: x86_64\nbuilt from commit: 4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64\ncompiler info: gnuc: 10.2\nlibc info: glibc: 2.31\n$SHELL (typically, interactive shell): <unset>\n\n\n[Enabled Hooks]\nnot run from a git repository - no hooks to show"}]}