{"thread":{"id":"57181","subject":"Stash Apply/Pop not restoring added files when conflict occurs on restore","startedAt":"2022-01-04T19:02:11Z","lastAt":"2022-01-05T06:17:11Z","messageCount":3,"participants":["AJ Henderson","rsbecker@nexbridge.com","Eric Sunshine"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"445456","messageId":"CACEm96jjWALB=iPiBNr0P5HrX9Oo3bXm_k1PpxsHm4Ns9M-vOQ@mail.gmail.com","threadId":"57181","inReplyTo":null,"subject":"Stash Apply/Pop not restoring added files when conflict occurs on restore","fromName":"AJ Henderson","fromEmail":"ahenderson@datto.com","sentAt":"2022-01-04T19:00:26Z","receivedAt":"2022-01-04T19:02:11Z","isPatch":false,"sender":{"key":"ahenderson@datto.com","avatar":null},"body":"I have had two developers have this problem 3 times.  When they are\ndoing a stash push with newly created files and old files, when they\ngo to do a stash pop, if there is no conflict, the files show up as\nexpected, but when there is a conflict, the modified files are\nrestored (and placed in a conflict state as expected), however, the\nnew files are not restored.\n\nWe are able to work around this issue by grabbing the files directly\nout of the log for the stash head, but are unsure why this behavior\nisn't working as expected.  It seems to be a new change in behavior as\nwe had never previously seen this issue, but have seen it 3 times now\nin the last few weeks.\n\nWe are running 64 bit Windows with Git For Windows version 2.34.1.windows.1\n\n"},{"id":"445475","messageId":"004201d801ae$e238f330$a6aad990$@nexbridge.com","threadId":"57181","inReplyTo":"CACEm96jjWALB=iPiBNr0P5HrX9Oo3bXm_k1PpxsHm4Ns9M-vOQ@mail.gmail.com","subject":"RE: Stash Apply/Pop not restoring added files when conflict occurs on restore","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2022-01-04T21:05:57Z","receivedAt":"2022-01-04T21:06:09Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On January 4, 2022 2:00 PM, AJ Henderson wrote:\n> I have had two developers have this problem 3 times.  When they are doing a\n> stash push with newly created files and old files, when they go to do a stash\n> pop, if there is no conflict, the files show up as expected, but when there is a\n> conflict, the modified files are restored (and placed in a conflict state as\n> expected), however, the new files are not restored.\n> \n> We are able to work around this issue by grabbing the files directly out of the\n> log for the stash head, but are unsure why this behavior isn't working as\n> expected.  It seems to be a new change in behavior as we had never\n> previously seen this issue, but have seen it 3 times now in the last few\n> weeks.\n> \n> We are running 64 bit Windows with Git For Windows version\n> 2.34.1.windows.1\n\nThis looks like a regression from 2.33.0 to 2.34.1 in git. I can recreate the problem in 2.34.1, as follows:\n\n$ mkdir test\n$ cd test\n$ git init\n$ cat >a <<-EOF\nHi\nEOF\n$ cat >b <<-EOF\nThere\nEOF\n$ git add .\n$ git commit -m \"First\"\n$ cat >a <<-EOF\nHello\nEOF\n$ cat >c <<-EOF\nSomething\nEOF\n$ git stash push --include-untracked\n$ cat >a <<-EOF\nConflict\nEOF\n$ git add a\n$ git commit -m \"Second\"\n$ git stash pop\nAuto-merging a\nCONFLICT (content): Merge conflict in a\nThe stash entry is kept in case you need it again.\n\n* d8411cf (HEAD -> master) Second\n| *   0bf6efc (refs/stash) WIP on master: c9bfeb9 First\n|/|\\\n| | * 002560a untracked files on master: c9bfeb9 First\n| * 6ad65b4 index on master: c9bfeb9 First\n|/\n* c9bfeb9 First\n\nThe stash contains c but has not been restored. In 2.33.0, c was restored and the conflict for a identified. In both versions, the stash is retained.\n--Randall\n\n\n"},{"id":"445505","messageId":"CAPig+cRhBg9fvAAfzQUrPKqyFKoBtx7GQoiwpyaQr0bajBvfHQ@mail.gmail.com","threadId":"57181","inReplyTo":"CACEm96jjWALB=iPiBNr0P5HrX9Oo3bXm_k1PpxsHm4Ns9M-vOQ@mail.gmail.com","subject":"Re: Stash Apply/Pop not restoring added files when conflict occurs on restore","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-01-05T06:15:55Z","receivedAt":"2022-01-05T06:17:11Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Jan 5, 2022 at 1:08 AM AJ Henderson <ahenderson@datto.com> wrote:\n> I have had two developers have this problem 3 times.  When they are\n> doing a stash push with newly created files and old files, when they\n> go to do a stash pop, if there is no conflict, the files show up as\n> expected, but when there is a conflict, the modified files are\n> restored (and placed in a conflict state as expected), however, the\n> new files are not restored.\n>\n> We are able to work around this issue by grabbing the files directly\n> out of the log for the stash head, but are unsure why this behavior\n> isn't working as expected.  It seems to be a new change in behavior as\n> we had never previously seen this issue, but have seen it 3 times now\n> in the last few weeks.\n\nAs a follow-up for anyone who comes across this thread in the future,\nElijah posted a patch[*] to fix this regression.\n\n[*] https://lore.kernel.org/git/pull.1180.git.git.1641337498996.gitgitgadget@gmail.com/\n"}]}