git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG} stash show does not show untracked files stashed (reposted)

From
Jeff King <peff@peff.net>
Date
Sep 4, 2019, 07:29 UTC
Message-ID
<20190904072926.GA18470@sigill.intra.peff.net>
In-Reply-To
<002901d55e8f$e4a4af70$adee0e50$@rogers.com>
On Thu, Aug 29, 2019 at 01:33:36PM -0400, randall.s.becker@rogers.com wrote:
Show 12 quoted lines
> I don't know whether this is new behaviour following changes to stash, but
> here goes.
> 
> Suppose I have files a,b,c,d modified, but only file d is in the index.
> After stash push  (or save) --include-untracked, stash show only displays
> file d. A subsequent pop will restore files a,b,c,d. So functionally push
> and pop are fine, but stash show appears to ignores files in the stash. The
> git log below shows a previous commit (dce2e3e) to the WIP stash (ab0834c)
> that does contain the untracked files, and git diff is happy to show the
> contents when using the ref directly. It is just counterintuitive for stash
> show not to display all entries previously pushed. I would have expected
> symmetry. This is not new.

Right, this is expected but unfortunate. The same problem occurs with stashed changes to the index. The fundamental issue is that a stash is not representing a single diff, but rather up to three diffs:

  - changes to the working tree
  - changes to the index
  - a set of untracked files
each of which is stored as a separate commit.

This has been discussed off and on. A while ago I suggested a possible output format that shows all three:

  https://public-inbox.org/git/20170317141417.g2oenl67k74nlqrq@sigill.intra.peff.net/

The patch there is useless now, as stash has been rewritten in C (though that probably means it would be possible to make it less hacky). The main obstacle IMHO is whether we're comfortable changing the output away from a single diff. I could imagine somebody scripting around stash, though if the output remained the same for stashes without index changes or untracked files, that makes problems less likely.

-Peff
Previous: randall.s.becker@rogers.com
Message 2 of 2 in “[BUG} stash show does not show untracked files stashed (reposted)”
  1. randall.s.becker@rogers.comAug 29, 2019
  2. Jeff KingSep 4, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.