{"thread":{"id":"57360","subject":"Git Bug Report: 'git stash pop' always put newly added files into staging area","startedAt":"2022-02-02T18:52:39Z","lastAt":"2022-02-03T13:27:55Z","messageCount":2,"participants":["Zhuo Cheng Du"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"447551","messageId":"CA+RO+X6Lat5-AZ+BoHwW8xzhXuNOTjQewyNAvzOjWF_Md0x_yA@mail.gmail.com","threadId":"57360","inReplyTo":null,"subject":"Git Bug Report: 'git stash pop' always put newly added files into staging area","fromName":"Zhuo Cheng Du","fromEmail":"zhuo@delphia.com","sentAt":"2022-02-02T18:50:29Z","receivedAt":"2022-02-02T18:52:39Z","isPatch":false,"sender":{"key":"zhuo@delphia.com","avatar":null},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\n1. Create a brand new file, e.g. 'touch a.py'\n2. Add it to worktree with 'git add a.py'\n3. stash the file with 'git stash'\n4. pop the stashed change with 'git stash pop', WITHOUT the --index option\n\nWhat did you expect to happen? (Expected behavior)\nI expect the file 'a.py' to be in unstaged area since I did not pass\nthe '--index' option to 'git stash pop'\n\nWhat happened instead? (Actual behavior)\nThe file is found in staged are are after 'git stash pop', potentially\ncausing merge-conflict in certain scenarios\n\nWhat's different between what you expected and what actually happened?\nI want the file to be found in unstaged area. The 'git stash\npush'/'git stash pop' combo works as expected if the file is already\nadded to worktree prior to this maneuver. I think the behavior should\nbe consistent for brand new files as well.\n\nAnything else you want to add:\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.31.0\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Darwin 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58\nPST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64\ncompiler info: clang: 12.0.0 (clang-1200.0.32.29)\nlibc info: no libc information available\n$SHELL (typically, interactive shell): /bin/zsh\n\n\n[Enabled Hooks]\n"},{"id":"447608","messageId":"CA+RO+X4GAXVEA44nqaAKVxAxxzGQkf66kLrwadw3qcsZhULJgQ@mail.gmail.com","threadId":"57360","inReplyTo":"CA+RO+X6Lat5-AZ+BoHwW8xzhXuNOTjQewyNAvzOjWF_Md0x_yA@mail.gmail.com","subject":"Re: Git Bug Report: 'git stash pop' always put newly added files into staging area","fromName":"Zhuo Cheng Du","fromEmail":"zhuo@delphia.com","sentAt":"2022-02-03T13:27:42Z","receivedAt":"2022-02-03T13:27:55Z","isPatch":false,"sender":{"key":"zhuo@delphia.com","avatar":null},"body":"Hi there,\n\nJust an update, I have upgraded git to the latest version (2.35.1),\nand this bug still exists.\n\nThanks,\nZhuo\n\nOn Wed, Feb 2, 2022 at 1:50 PM Zhuo Cheng Du <zhuo@delphia.com> wrote:\n>\n> What did you do before the bug happened? (Steps to reproduce your issue)\n> 1. Create a brand new file, e.g. 'touch a.py'\n> 2. Add it to worktree with 'git add a.py'\n> 3. stash the file with 'git stash'\n> 4. pop the stashed change with 'git stash pop', WITHOUT the --index option\n>\n> What did you expect to happen? (Expected behavior)\n> I expect the file 'a.py' to be in unstaged area since I did not pass\n> the '--index' option to 'git stash pop'\n>\n> What happened instead? (Actual behavior)\n> The file is found in staged are are after 'git stash pop', potentially\n> causing merge-conflict in certain scenarios\n>\n> What's different between what you expected and what actually happened?\n> I want the file to be found in unstaged area. The 'git stash\n> push'/'git stash pop' combo works as expected if the file is already\n> added to worktree prior to this maneuver. I think the behavior should\n> be consistent for brand new files as well.\n>\n> Anything else you want to add:\n>\n> Please review the rest of the bug report below.\n> You can delete any lines you don't wish to share.\n>\n>\n> [System Info]\n> git version:\n> git version 2.31.0\n> cpu: x86_64\n> no commit associated with this build\n> sizeof-long: 8\n> sizeof-size_t: 8\n> shell-path: /bin/sh\n> uname: Darwin 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58\n> PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64\n> compiler info: clang: 12.0.0 (clang-1200.0.32.29)\n> libc info: no libc information available\n> $SHELL (typically, interactive shell): /bin/zsh\n>\n>\n> [Enabled Hooks]\n"}]}