On Thu, Aug 29, 2019 at 01:33:36PM -0400, randall.s.bec...@rogers.com wrote:

> 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.g2oenl67k74nl...@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

Reply via email to