{"thread":{"id":"8876","subject":"Re: [PATCH] stash: end commit log with a newline","startedAt":"2007-07-05T05:46:09Z","lastAt":"2007-07-05T23:54:31Z","messageCount":4,"participants":["Junio C Hamano","Uwe Kleine-König","しらいしななこ"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"46529","messageId":"7vbqere732.fsf@assigned-by-dhcp.cox.net","threadId":"8876","inReplyTo":"200707042324.l64NOp8I019289@mi0.bluebottle.com","subject":"Re: [PATCH] stash: end commit log with a newline","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-05T05:46:09Z","receivedAt":"2007-07-05T05:46:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"しらいしななこ <nanako3@bluebottle.com> writes:\n\n> I am sorry to join the discussion late, but I think it is much better to let\n> the user give a short reminder message from the command line.  For example,\n>\n>   $ git stash add customized message to stash\n>\n> When I say \"git stash list\", I want to see which branch I was on when I was\n> in the middle of doing something, and what that something was.  It is not\n> interesting which commit on that branch I started that change from.  After\n> creating a stash without a message, and then another stash with a message, I\n> want to see:\n>\n>   $ git stash list\n>   stash@{0}: On master: add customized message to stash\n>   stash@{1}: WIP on master: 36e5e70... Start deprecating \"git-command\" in favor of \"git command\"\n\nHmph.  I only recently got interested in \"stash\", so have not\nenough real-life experience to base my judgement on, but I think\nI'd agree with your reasoning.\n\nPerhaps something like this?\n\n-- >8 --\n[PATCH] git-stash: allow more descriptive reminder message when saving\n\nThis allows you to say:\n\n\t$ git stash starting to implement X\n\nwhile creating a stash, and the resulting \"stash list entry\nwould read as:\n\n\t$ git stash list\n        stash@{0}: On master: starting to implement X\n\ninstead of the default message which talks about the commit the\nstash happens to be based on (hence does not have much to do\nwith what the stashed change is trying to do).\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n git-stash.sh |   25 +++++++++++++++++++------\n 1 files changed, 19 insertions(+), 6 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 9deda44..3d7db4a 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -23,6 +23,8 @@ clear_stash () {\n }\n \n save_stash () {\n+\tstash_msg=\"$1\"\n+\n \tif no_changes\n \tthen\n \t\techo >&2 'No local changes to save'\n@@ -67,13 +69,19 @@ save_stash () {\n \t\tdie \"Cannot save the current worktree state\"\n \n \t# create the stash\n-\tw_commit=$(printf 'WIP on %s\\n' \"$msg\" |\n+\tif test -z \"$stash_msg\"\n+\tthen\n+\t\tstash_msg=$(printf 'WIP on %s' \"$msg\")\n+\telse\n+\t\tstash_msg=$(printf 'On %s: %s' \"$branch\" \"$stash_msg\")\n+\tfi\n+\tw_commit=$(printf '%s\\n' \"$stash_msg\" |\n \t\tgit commit-tree $w_tree -p $b_commit -p $i_commit) ||\n \t\tdie \"Cannot record working tree state\"\n \n-\tgit update-ref -m \"$msg\" $ref_stash $w_commit ||\n+\tgit update-ref -m \"$stash_msg\" $ref_stash $w_commit ||\n \t\tdie \"Cannot save the current status\"\n-\tprintf >&2 'Saved WIP on %s\\n' \"$msg\"\n+\tprintf >&2 'Saved \"%s\"\\n' \"$stash_msg\"\n }\n \n have_stash () {\n@@ -157,9 +165,14 @@ apply)\n clear)\n \tclear_stash\n \t;;\n-save | '')\n-\tsave_stash && git-reset --hard\n+help)\n+\tusage\n \t;;\n *)\n-\tusage\n+\tif test $# -gt 0 && test \"$1\" = save\n+\tthen\n+\t\tshift\n+\tfi\n+\tsave_stash \"$*\" && git-reset --hard\n+\t;;\n esac\n\n\n-- \nJunio C Hamano\nhttp://gitster.livejournal.com/\n\n----------------------------------------------------------------------\nNo advertising message here ;-)\nhttp://www.ohloh.net/projects/278\n"},{"id":"46542","messageId":"20070705115825.GA13654@informatik.uni-freiburg.de","threadId":"8876","inReplyTo":"7vbqere732.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] stash: end commit log with a newline","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@informatik.uni-freiburg.de","sentAt":"2007-07-05T11:58:25Z","receivedAt":"2007-07-05T11:58:25Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> しらいしななこ <nanako3@bluebottle.com> writes:\n> \n> > I am sorry to join the discussion late, but I think it is much better to let\n> > the user give a short reminder message from the command line.  For example,\n> >\n> >   $ git stash add customized message to stash\n> >\n> > When I say \"git stash list\", I want to see which branch I was on when I was\n> > in the middle of doing something, and what that something was.  It is not\n> > interesting which commit on that branch I started that change from.  After\n> > creating a stash without a message, and then another stash with a message, I\n> > want to see:\n> >\n> >   $ git stash list\n> >   stash@{0}: On master: add customized message to stash\n> >   stash@{1}: WIP on master: 36e5e70... Start deprecating \"git-command\" in favor of \"git command\"\n> \n> Hmph.  I only recently got interested in \"stash\", so have not\n> enough real-life experience to base my judgement on, but I think\n> I'd agree with your reasoning.\n> \n> Perhaps something like this?\nI didn't test it yet, but it sounds good.  I will apply your patch and\nwork a while with it.  But I think if someone adds documentation, I will\ngive my Ack. :-)\n\nBTW: I prefer help over usage, but if it nanako prefers usage, why not\nboth?\n\nBest regards\nUwe\n\n-- \nUwe Kleine-König\n\nhttp://www.google.com/search?q=1+stone%3D\n"},{"id":"46557","messageId":"7vodiqdcgl.fsf@assigned-by-dhcp.cox.net","threadId":"8876","inReplyTo":"20070705115825.GA13654@informatik.uni-freiburg.de","subject":"Re: [PATCH] stash: end commit log with a newline","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-05T16:47:38Z","receivedAt":"2007-07-05T16:47:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Uwe Kleine-König  <ukleinek@informatik.uni-freiburg.de> writes:\n\n> I didn't test it yet, but it sounds good.  I will apply your patch and\n> work a while with it.  But I think if someone adds documentation, I will\n> give my Ack. :-)\n>\n> BTW: I prefer help over usage, but if it nanako prefers usage, why not\n> both?\n\nWe could do that, I guess.  Nana?\n"},{"id":"46577","messageId":"200707060001.l6601tjS024564@mi1.bluebottle.com","threadId":"8876","inReplyTo":"7vodiqdcgl.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] stash: end commit log with a newline","fromName":"しらいしななこ","fromEmail":"nanako3@bluebottle.com","sentAt":"2007-07-05T23:54:31Z","receivedAt":"2007-07-05T23:54:31Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Junio C Hamano <gitster@pobox.com>:\n\n> Uwe Kleine-König  <ukleinek@informatik.uni-freiburg.de> writes:\n>\n>> I didn't test it yet, but it sounds good.  I will apply your patch and\n>> work a while with it.  But I think if someone adds documentation, I will\n>> give my Ack. :-)\n>>\n>> BTW: I prefer help over usage, but if it nanako prefers usage, why not\n>> both?\n>\n> We could do that, I guess.  Nana?\n\nThank you very much for asking.\n\nI think it is good to accept both usage and help, then.  I will try your\npatch myself and will report if I can think of further improvements.\n\nPlease do not expect much documentation from me, however.  My writing is\nnot very good.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n\n----------------------------------------------------------------------\nFind out how you can get spam free email.\nhttp://www.bluebottle.com/tag/3\n"}]}