{"thread":{"id":"62196","subject":"\"git stash push\" doesn't respect pathspec regarding files added to index","startedAt":"2024-09-26T16:44:27Z","lastAt":"2024-09-26T16:44:27Z","messageCount":1,"participants":["Piotr Siupa"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"503578","messageId":"CAPM0=yD3SevBKhCOqOzjpEqX=4Z7BLJU2hKRFb2KtOgFEco8cw@mail.gmail.com","threadId":"62196","inReplyTo":null,"subject":"\"git stash push\" doesn't respect pathspec regarding files added to index","fromName":"Piotr Siupa","fromEmail":"piotrsiupa@gmail.com","sentAt":"2024-09-26T16:44:10Z","receivedAt":"2024-09-26T16:44:27Z","isPatch":false,"sender":{"key":"piotrsiupa@gmail.com","avatar":"https://gravatar.com/avatar/5970da465a147bda2b821a29e966ed328cca93067a42d05cf33ee38aac4acd6f?d=mp&s=160"},"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)\n# Create repository with two files\ngit init\necho 'old contents in foo' >foo\necho 'old contents in bar' >bar\ngit add foo bar\ngit commit -m 'init'\n# Modify both files and add them to index\necho 'new contents in foo' >foo\necho 'new contents in bar' >bar\ngit add foo bar\n# Push stash with only \"foo\" in the pathspec\ngit stash push foo\n# Reset and pop the stash\ngit reset --hard\ngit stash pop\n\nWhat did you expect to happen? (Expected behavior)\nOnly the file \"foo\" should be restored from the stash.\n\nWhat happened instead? (Actual behavior)\nThe stash entry stores and consequently restores changes in both files.\n\nWhat's different between what you expected and what actually happened?\nThe changes in the file \"bar\" should not be included in the created stash entry.\n\nAnything else you want to add:\nThis happens only if the files are added to the index.\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.34.1\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 6.8.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC\nWed Sep 11 15:25:05 UTC 2 x86_64\ncompiler info: gnuc: 11.4\nlibc info: glibc: 2.35\n$SHELL (typically, interactive shell): /bin/bash\n\n\n[Enabled Hooks]\n\nRegards\nPiotr Siupa\n"}]}