git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [BUG} stash show does not show untracked files stashed (reposted)
@ 2019-08-29 17:33 randall.s.becker
  2019-09-04  7:29 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: randall.s.becker @ 2019-08-29 17:33 UTC (permalink / raw)
  To: git

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.

*-.   ab0834c (refs/stash) WIP on master: bf223fc Updated known
|\ \
| | * dce2e3e untracked files on master: bf223fc Updated known
| * a5ad1ef index on master: bf223fc Updated known
|/
* bf223fc (HEAD -> master) Updated known
* db0efd4 (origin/master, origin/HEAD) initial

This on git 2.23.0. I have the same behaviour on the Windows build of git
2.12.3.

builtins/stash.c show_stash() does not look like it accounts for multiple
paths when calling setup_revisions, so I think it is missing the path to the
untracked file ref (dce2e32). I am guessing.

Thanks,
Randall

-- Brief whoami:
 NonStop developer since approximately 211288444200000000
 UNIX developer since approximately 421664400
-- In my real life, I talk too much.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG} stash show does not show untracked files stashed (reposted)
@ 2019-09-02 13:01 Giuseppe Crinò
  2019-09-02 15:56 ` Philip Oakley
  0 siblings, 1 reply; 5+ messages in thread
From: Giuseppe Crinò @ 2019-09-02 13:01 UTC (permalink / raw)
  To: randall.s.becker; +Cc: git

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

This is more of an enhancement, isn't it?

To reproduce

$ touch a b c d
$ git add d
$ git stash push --include-untracked
$ git stash show
 d | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

What is the output that you think should be printed?

-Giuseppe

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG} stash show does not show untracked files stashed (reposted)
  2019-09-02 13:01 Giuseppe Crinò
@ 2019-09-02 15:56 ` Philip Oakley
  2019-09-02 18:15   ` randall.s.becker
  0 siblings, 1 reply; 5+ messages in thread
From: Philip Oakley @ 2019-09-02 15:56 UTC (permalink / raw)
  To: 002901d55e8f$e4a4af70$adee0e50$, randall.s.becker; +Cc: git

On 02/09/2019 14:01, Giuseppe Crinò wrote:
>> 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.
> This is more of an enhancement, isn't it?
>
> To reproduce
>
> $ touch a b c d
> $ git add d
> $ git stash push --include-untracked
> $ git stash show
>   d | 0
>   1 file changed, 0 insertions(+), 0 deletions(-)
>
> What is the output that you think should be printed?
>

I'd guess

  1 file changed, 0 insertions(+), 0 deletions(-), *3 files untracked*

as they are what's meant to be in the stash... (obviously format to taste)
Philip


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [BUG} stash show does not show untracked files stashed (reposted)
  2019-09-02 15:56 ` Philip Oakley
@ 2019-09-02 18:15   ` randall.s.becker
  0 siblings, 0 replies; 5+ messages in thread
From: randall.s.becker @ 2019-09-02 18:15 UTC (permalink / raw)
  To: 'Philip Oakley', 002901d55e8f$e4a4af70$adee0e50$; +Cc: git

> -----Original Message-----
> From: Philip Oakley <philipoakley@iee.email>
> Sent: September 2, 2019 11:56 AM
> To: 002901d55e8f$e4a4af70$adee0e50$@rogers.com;
> randall.s.becker@rogers.com
> Cc: git@vger.kernel.org
> Subject: Re: [BUG} stash show does not show untracked files stashed
> (reposted)
> 
> On 02/09/2019 14:01, Giuseppe Crinò wrote:
> >> 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.
> > This is more of an enhancement, isn't it?
> >
> > To reproduce
> >
> > $ touch a b c d
> > $ git add d
> > $ git stash push --include-untracked
> > $ git stash show
> >   d | 0
> >   1 file changed, 0 insertions(+), 0 deletions(-)
> >
> > What is the output that you think should be printed?
> >
> 
> I'd guess
> 
>   1 file changed, 0 insertions(+), 0 deletions(-), *3 files untracked*
> 
> as they are what's meant to be in the stash... (obviously format to taste)

More like this, from git stash show -p, to be consistent with git show -p 4ef9fc3 (the ref for the untracked files), showing 0000000 indicating that the file is not tracked.

diff --git a/d b/d
index e3e2f1d..f246285 100644
--- a/a
+++ b/a
@@ -2,3 +2,4 @@ This is file 1
 Yet another line
 New line
 New line 2
+ another line
diff --git a/a b/a
new file mode 100644
index 0000000..64d8b7a
--- /dev/null
+++ b/a
@@ -0,0 +1 @@
+line in a
diff --git a/b b/b
new file mode 100644
index 0000000..9aeb214
--- /dev/null
+++ b/b
@@ -0,0 +1 @@
+line in b
diff --git a/c b/c
new file mode 100644
index 0000000..87bb92b
--- /dev/null
+++ b/c
@@ -0,0 +1 @@
+line in c



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [BUG} stash show does not show untracked files stashed (reposted)
  2019-08-29 17:33 [BUG} stash show does not show untracked files stashed (reposted) randall.s.becker
@ 2019-09-04  7:29 ` Jeff King
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff King @ 2019-09-04  7:29 UTC (permalink / raw)
  To: randall.s.becker; +Cc: git

On Thu, Aug 29, 2019 at 01:33:36PM -0400, randall.s.becker@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.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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-04  7:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29 17:33 [BUG} stash show does not show untracked files stashed (reposted) randall.s.becker
2019-09-04  7:29 ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2019-09-02 13:01 Giuseppe Crinò
2019-09-02 15:56 ` Philip Oakley
2019-09-02 18:15   ` randall.s.becker

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).