{"thread":{"id":"19635","subject":"[PATCH] Show presense of stashed changes in bash prompt.","startedAt":"2009-06-02T11:43:25Z","lastAt":"2009-06-02T18:36:37Z","messageCount":5,"participants":["Daniel Trstenjak","Shawn O. Pearce","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"115237","messageId":"20090602114325.GA3427@laptop","threadId":"19635","inReplyTo":null,"subject":"[PATCH] Show presense of stashed changes in bash prompt.","fromName":"Daniel Trstenjak","fromEmail":"daniel.trstenjak@online.de","sentAt":"2009-06-02T11:43:25Z","receivedAt":"2009-06-02T11:43:25Z","isPatch":true,"sender":{"key":"daniel.trstenjak@gmail.com","avatar":null},"body":"Avoid the forgetting of stashed changes by showing\nthem in the bash prompt.\n\nIf the presense is shown is configurable by setting\nGIT_PS1_SHOW_STASH_STATE to a nonempty value.\n\nThe code for checking if the stash has entries is\ntaken from 'git-stash.sh'.\n\nSigned-off-by: Daniel Trstenjak <daniel.trstenjak@online.de>\n---\n contrib/completion/git-completion.bash |   12 ++++++++++--\n 1 files changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 98b9cbe..ed0c463 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -40,6 +40,10 @@\n #       with the bash.showDirtyState variable, which defaults to true\n #       once GIT_PS1_SHOWDIRTYSTATE is enabled.\n #\n+#       You can also see if currently something is stashed, by setting\n+#       GIT_PS1_SHOW_STASH_STATE to a nonempty value. If something is stashed,\n+#       then a '$' will be shown next to the branch name. \n+#\n # To submit patches:\n #\n #    *) Read Documentation/SubmittingPatches\n@@ -127,6 +131,7 @@ __git_ps1 ()\n \n \t\tlocal w\n \t\tlocal i\n+\t\tlocal s\n \t\tlocal c\n \n \t\tif [ \"true\" = \"$(git rev-parse --is-inside-git-dir 2>/dev/null)\" ]; then\n@@ -148,12 +153,15 @@ __git_ps1 ()\n \t\t\t\t\tfi\n \t\t\t\tfi\n \t\t\tfi\n+\t\t\tif [ -n \"${GIT_PS1_SHOW_STASH_STATE-}\" ]; then\n+\t\t\t        git rev-parse --verify refs/stash >/dev/null 2>&1 && s=\"$\"\n+\t\t\tfi\n \t\tfi\n \n \t\tif [ -n \"${1-}\" ]; then\n-\t\t\tprintf \"$1\" \"$c${b##refs/heads/}$w$i$r\"\n+\t\t\tprintf \"$1\" \"$c${b##refs/heads/}$w$i$s$r\"\n \t\telse\n-\t\t\tprintf \" (%s)\" \"$c${b##refs/heads/}$w$i$r\"\n+\t\t\tprintf \" (%s)\" \"$c${b##refs/heads/}$w$i$s$r\"\n \t\tfi\n \tfi\n }\n-- \n1.6.1.2\n"},{"id":"115253","messageId":"20090602152915.GK30527@spearce.org","threadId":"19635","inReplyTo":"7vzlcqfyli.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Show presense of stashed changes in bash prompt.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-06-02T15:29:15Z","receivedAt":"2009-06-02T15:29:15Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Daniel Trstenjak <Daniel.Trstenjak@online.de> writes:\n> > Avoid the forgetting of stashed changes by showing\n> > them in the bash prompt.\n> >\n> > If the presense is shown is configurable by setting\n> > GIT_PS1_SHOW_STASH_STATE to a nonempty value.\n> \n> Why am I getting this deja-vu feeling about this patch, I wonder...  Is\n> this a re-roll of a previously posted patch?\n\nI don't know... I had a similar deja-vu feeling when I read it.\n \n> Shawn?\n\nInitial NAK, see below for the nit.\n \n> > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> > index 98b9cbe..ed0c463 100755\n> > --- a/contrib/completion/git-completion.bash\n> > +++ b/contrib/completion/git-completion.bash\n> > @@ -40,6 +40,10 @@\n> >  #       with the bash.showDirtyState variable, which defaults to true\n> >  #       once GIT_PS1_SHOWDIRTYSTATE is enabled.\n> >  #\n> > +#       You can also see if currently something is stashed, by setting\n> > +#       GIT_PS1_SHOW_STASH_STATE to a nonempty value. If something is stashed,\n> > +#       then a '$' will be shown next to the branch name. \n> > +#\n\nCan we call this GIT_PS1_SHOWSTASHSTATE to match the already present\nGIT_PS1_SHOWDIRTYSTATE in at least style formatting?\n\nThe bike shed already sailed... GIT_PS1_SHOWDIRTYSTATE shipped in\n1.6.3.  Lets keep the same style.\n\nOtherwise it looks fine to me, when you resend you can add my\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\n-- \nShawn.\n"},{"id":"115264","messageId":"20090602180322.GA5719@laptop","threadId":"19635","inReplyTo":"20090602152915.GK30527@spearce.org","subject":"Re: [PATCH] Show presense of stashed changes in bash prompt.","fromName":"Daniel Trstenjak","fromEmail":"daniel.trstenjak@online.de","sentAt":"2009-06-02T18:03:22Z","receivedAt":"2009-06-02T18:03:22Z","isPatch":true,"sender":{"key":"daniel.trstenjak@gmail.com","avatar":null},"body":"Avoid the forgetting of stashed changes by showing\nthem in the bash prompt.\n\nIf the presense is shown is configurable by setting\nGIT_PS1_SHOWSTASHSTATE to a nonempty value.\n\nThe code for checking if the stash has entries is\ntaken from 'git-stash.sh'.\n\nSigned-off-by: Daniel Trstenjak <daniel.trstenjak@online.de>\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n---\n contrib/completion/git-completion.bash |   12 ++++++++++--\n 1 files changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 98b9cbe..c4ae423 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -40,6 +40,10 @@\n #       with the bash.showDirtyState variable, which defaults to true\n #       once GIT_PS1_SHOWDIRTYSTATE is enabled.\n #\n+#       You can also see if currently something is stashed, by setting\n+#       GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,\n+#       then a '$' will be shown next to the branch name. \n+#\n # To submit patches:\n #\n #    *) Read Documentation/SubmittingPatches\n@@ -127,6 +131,7 @@ __git_ps1 ()\n \n \t\tlocal w\n \t\tlocal i\n+\t\tlocal s\n \t\tlocal c\n \n \t\tif [ \"true\" = \"$(git rev-parse --is-inside-git-dir 2>/dev/null)\" ]; then\n@@ -148,12 +153,15 @@ __git_ps1 ()\n \t\t\t\t\tfi\n \t\t\t\tfi\n \t\t\tfi\n+\t\t\tif [ -n \"${GIT_PS1_SHOWSTASHSTATE-}\" ]; then\n+\t\t\t        git rev-parse --verify refs/stash >/dev/null 2>&1 && s=\"$\"\n+\t\t\tfi\n \t\tfi\n \n \t\tif [ -n \"${1-}\" ]; then\n-\t\t\tprintf \"$1\" \"$c${b##refs/heads/}$w$i$r\"\n+\t\t\tprintf \"$1\" \"$c${b##refs/heads/}$w$i$s$r\"\n \t\telse\n-\t\t\tprintf \" (%s)\" \"$c${b##refs/heads/}$w$i$r\"\n+\t\t\tprintf \" (%s)\" \"$c${b##refs/heads/}$w$i$s$r\"\n \t\tfi\n \tfi\n }\n-- \n1.6.1.2\n"},{"id":"115265","messageId":"20090602180439.GB5719@laptop","threadId":"19635","inReplyTo":"7vzlcqfyli.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Show presense of stashed changes in bash prompt.","fromName":"Daniel Trstenjak","fromEmail":"daniel.trstenjak@online.de","sentAt":"2009-06-02T18:04:39Z","receivedAt":"2009-06-02T18:04:39Z","isPatch":true,"sender":{"key":"daniel.trstenjak@gmail.com","avatar":null},"body":"\n> Why am I getting this deja-vu feeling about this patch, I wonder...  Is\n> this a re-roll of a previously posted patch?\n\nYup.\n\nGreetings,\nDaniel\n"},{"id":"115267","messageId":"h03rfk$t5l$1@ger.gmane.org","threadId":"19635","inReplyTo":"20090602180322.GA5719@laptop","subject":"Re: [PATCH] Show presense of stashed changes in bash prompt.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-06-02T18:36:37Z","receivedAt":"2009-06-02T18:36:37Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Daniel Trstenjak wrote:\n\n> If the presense is shown is configurable by setting\n> GIT_PS1_SHOWSTASHSTATE to a nonempty value.\n\n_presence_\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}