{"thread":{"id":"51774","subject":"[BUG} stash show does not show untracked files stashed (reposted)","startedAt":"2019-08-29T17:33:46Z","lastAt":"2019-09-04T07:29:29Z","messageCount":2,"participants":["randall.s.becker@rogers.com","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"381525","messageId":"002901d55e8f$e4a4af70$adee0e50$@rogers.com","threadId":"51774","inReplyTo":null,"subject":"[BUG} stash show does not show untracked files stashed (reposted)","fromName":"","fromEmail":"randall.s.becker@rogers.com","sentAt":"2019-08-29T17:33:36Z","receivedAt":"2019-08-29T17:33:46Z","isPatch":false,"sender":{"key":"randall.s.becker@rogers.com","avatar":null},"body":"I don't know whether this is new behaviour following changes to stash, but\nhere goes.\n\nSuppose I have files a,b,c,d modified, but only file d is in the index.\nAfter stash push  (or save) --include-untracked, stash show only displays\nfile d. A subsequent pop will restore files a,b,c,d. So functionally push\nand pop are fine, but stash show appears to ignores files in the stash. The\ngit log below shows a previous commit (dce2e3e) to the WIP stash (ab0834c)\nthat does contain the untracked files, and git diff is happy to show the\ncontents when using the ref directly. It is just counterintuitive for stash\nshow not to display all entries previously pushed. I would have expected\nsymmetry. This is not new.\n\n*-.   ab0834c (refs/stash) WIP on master: bf223fc Updated known\n|\\ \\\n| | * dce2e3e untracked files on master: bf223fc Updated known\n| * a5ad1ef index on master: bf223fc Updated known\n|/\n* bf223fc (HEAD -> master) Updated known\n* db0efd4 (origin/master, origin/HEAD) initial\n\nThis on git 2.23.0. I have the same behaviour on the Windows build of git\n2.12.3.\n\nbuiltins/stash.c show_stash() does not look like it accounts for multiple\npaths when calling setup_revisions, so I think it is missing the path to the\nuntracked file ref (dce2e32). I am guessing.\n\nThanks,\nRandall\n\n-- Brief whoami:\n NonStop developer since approximately 211288444200000000\n UNIX developer since approximately 421664400\n-- In my real life, I talk too much.\n\n\n\n"},{"id":"381795","messageId":"20190904072926.GA18470@sigill.intra.peff.net","threadId":"51774","inReplyTo":"002901d55e8f$e4a4af70$adee0e50$@rogers.com","subject":"Re: [BUG} stash show does not show untracked files stashed (reposted)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-09-04T07:29:27Z","receivedAt":"2019-09-04T07:29:29Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 29, 2019 at 01:33:36PM -0400, randall.s.becker@rogers.com wrote:\n\n> I don't know whether this is new behaviour following changes to stash, but\n> here goes.\n> \n> Suppose I have files a,b,c,d modified, but only file d is in the index.\n> After stash push  (or save) --include-untracked, stash show only displays\n> file d. A subsequent pop will restore files a,b,c,d. So functionally push\n> and pop are fine, but stash show appears to ignores files in the stash. The\n> git log below shows a previous commit (dce2e3e) to the WIP stash (ab0834c)\n> that does contain the untracked files, and git diff is happy to show the\n> contents when using the ref directly. It is just counterintuitive for stash\n> show not to display all entries previously pushed. I would have expected\n> symmetry. This is not new.\n\nRight, this is expected but unfortunate. The same problem occurs with\nstashed changes to the index. The fundamental issue is that a stash is\nnot representing a single diff, but rather up to three diffs:\n\n  - changes to the working tree\n\n  - changes to the index\n\n  - a set of untracked files\n\neach of which is stored as a separate commit.\n\nThis has been discussed off and on. A while ago I suggested a possible\noutput format that shows all three:\n\n  https://public-inbox.org/git/20170317141417.g2oenl67k74nlqrq@sigill.intra.peff.net/\n\nThe patch there is useless now, as stash has been rewritten in C (though\nthat probably means it would be possible to make it less hacky). The\nmain obstacle IMHO is whether we're comfortable changing the output away\nfrom a single diff. I could imagine somebody scripting around stash,\nthough if the output remained the same for stashes without index changes\nor untracked files, that makes problems less likely.\n\n-Peff\n"}]}