git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
To: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Behaviour of 'git stash show' when a stash has untracked files
Date: Sat, 23 Sep 2017 12:33:51 +0530	[thread overview]
Message-ID: <1506150231.3877.3.camel@gmail.com> (raw)
In-Reply-To: <20170920193630.l7ifret5dpqgxiwm@sigill.intra.peff.net>

On Wed, 2017-09-20 at 15:36 -0400, Jeff King wrote:
> 
> Or sometimes people are just really behind in reading the mailing list. ;)
> 
> This seemed familiar, and indeed there was some discussion a few months
> ago:
> 
>   https://public-inbox.org/git/CAOtcWM3mrQEqDnjMipzea7Kp+VueBFsZDL2zcJ=y0wgj9N4Vjw@mail.gmail.com/
> 
> I sketched out a possible solution in:
> 
>   https://public-inbox.org/git/20170317141417.g2oenl67k74nlqrq@sigill.intra.peff.net/
> 

It seems I should have searched the list without being lazy before I
sent this one. Anyways, the output of the patch there sound a little
interesting.

> though I share your concerns over whether people would be annoyed to see
> the existing "stash show" output changed.
> 

Though I'm not sure whether people would be annoyed about the change in
output, I personally find it a little odd to show the contents of
untracked files as if they have been "added" to the index (although
there is notice that these are "untracked-files"). I think that might
puzzle some users.

That said, when I actually sent this mail I was thinking of an
implementation of the following sort (thanks Peff!),

diff --git a/git-stash.sh b/git-stash.sh
index 8b2ce9afd..b79adc138 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -401,7 +401,10 @@ show_stash () {
                fi
        fi
 
-       git diff ${FLAGS} $b_commit $w_commit
+       {
+               git diff ${FLAGS} $b_commit $w_commit
+               test -n "$u_commit" && git show  --pretty=format:'%nUntracked files: ' ${FLAGS} $u_commit -- .
+       } | git_pager
 }
 
 show_help () {

I would like to turn this off when patch mode is requested, but I
currently couldn't. I would also like to print only the names of the
files, if possible.

I find this kind of output better than showing nothing at all or
showing the output of untracked files in the form of a diff when patch
mode is requested. IOW, this satisfies my expectation though I'm not
sure how much this would be useful to others.

---
Kaartic

  parent reply	other threads:[~2017-09-23  7:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-17  5:27 Behaviour of 'git stash show' when a stash has untracked files Kaartic Sivaraam
2017-09-20  5:33 ` Junio C Hamano
2017-09-20 19:36   ` Jeff King
2017-09-21  1:23     ` Junio C Hamano
2017-09-21  3:31       ` Jeff King
2017-09-23  7:11         ` Kaartic Sivaraam
2017-09-24  0:41         ` Junio C Hamano
2017-09-23  7:03     ` Kaartic Sivaraam [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-17  5:07 Kaartic Sivaraam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1506150231.3877.3.camel@gmail.com \
    --to=kaarticsivaraam91196@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).