* Re: [PATCH] stash: end commit log with a newline [not found] <200707042324.l64NOp8I019289@mi0.bluebottle.com> @ 2007-07-05 5:46 ` Junio C Hamano 2007-07-05 11:58 ` Uwe Kleine-König 0 siblings, 1 reply; 12+ messages in thread From: Junio C Hamano @ 2007-07-05 5:46 UTC (permalink / raw) To: しらいしななこ Cc: Uwe Kleine-König, Git Mailing List しらいしななこ <nanako3@bluebottle.com> writes: > I am sorry to join the discussion late, but I think it is much better to let > the user give a short reminder message from the command line. For example, > > $ git stash add customized message to stash > > When I say "git stash list", I want to see which branch I was on when I was > in the middle of doing something, and what that something was. It is not > interesting which commit on that branch I started that change from. After > creating a stash without a message, and then another stash with a message, I > want to see: > > $ git stash list > stash@{0}: On master: add customized message to stash > stash@{1}: WIP on master: 36e5e70... Start deprecating "git-command" in favor of "git command" Hmph. I only recently got interested in "stash", so have not enough real-life experience to base my judgement on, but I think I'd agree with your reasoning. Perhaps something like this? -- >8 -- [PATCH] git-stash: allow more descriptive reminder message when saving This allows you to say: $ git stash starting to implement X while creating a stash, and the resulting "stash list entry would read as: $ git stash list stash@{0}: On master: starting to implement X instead of the default message which talks about the commit the stash happens to be based on (hence does not have much to do with what the stashed change is trying to do). Signed-off-by: Junio C Hamano <junkio@cox.net> --- git-stash.sh | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-) diff --git a/git-stash.sh b/git-stash.sh index 9deda44..3d7db4a 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -23,6 +23,8 @@ clear_stash () { } save_stash () { + stash_msg="$1" + if no_changes then echo >&2 'No local changes to save' @@ -67,13 +69,19 @@ save_stash () { die "Cannot save the current worktree state" # create the stash - w_commit=$(printf 'WIP on %s\n' "$msg" | + if test -z "$stash_msg" + then + stash_msg=$(printf 'WIP on %s' "$msg") + else + stash_msg=$(printf 'On %s: %s' "$branch" "$stash_msg") + fi + w_commit=$(printf '%s\n' "$stash_msg" | git commit-tree $w_tree -p $b_commit -p $i_commit) || die "Cannot record working tree state" - git update-ref -m "$msg" $ref_stash $w_commit || + git update-ref -m "$stash_msg" $ref_stash $w_commit || die "Cannot save the current status" - printf >&2 'Saved WIP on %s\n' "$msg" + printf >&2 'Saved "%s"\n' "$stash_msg" } have_stash () { @@ -157,9 +165,14 @@ apply) clear) clear_stash ;; -save | '') - save_stash && git-reset --hard +help) + usage ;; *) - usage + if test $# -gt 0 && test "$1" = save + then + shift + fi + save_stash "$*" && git-reset --hard + ;; esac -- Junio C Hamano http://gitster.livejournal.com/ ---------------------------------------------------------------------- No advertising message here ;-) http://www.ohloh.net/projects/278 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] stash: end commit log with a newline 2007-07-05 5:46 ` [PATCH] stash: end commit log with a newline Junio C Hamano @ 2007-07-05 11:58 ` Uwe Kleine-König 2007-07-05 16:47 ` Junio C Hamano 0 siblings, 1 reply; 12+ messages in thread From: Uwe Kleine-König @ 2007-07-05 11:58 UTC (permalink / raw) To: Junio C Hamano Cc: しらいしななこ, Git Mailing List Junio C Hamano wrote: > しらいしななこ <nanako3@bluebottle.com> writes: > > > I am sorry to join the discussion late, but I think it is much better to let > > the user give a short reminder message from the command line. For example, > > > > $ git stash add customized message to stash > > > > When I say "git stash list", I want to see which branch I was on when I was > > in the middle of doing something, and what that something was. It is not > > interesting which commit on that branch I started that change from. After > > creating a stash without a message, and then another stash with a message, I > > want to see: > > > > $ git stash list > > stash@{0}: On master: add customized message to stash > > stash@{1}: WIP on master: 36e5e70... Start deprecating "git-command" in favor of "git command" > > Hmph. I only recently got interested in "stash", so have not > enough real-life experience to base my judgement on, but I think > I'd agree with your reasoning. > > Perhaps something like this? I didn't test it yet, but it sounds good. I will apply your patch and work a while with it. But I think if someone adds documentation, I will give my Ack. :-) BTW: I prefer help over usage, but if it nanako prefers usage, why not both? Best regards Uwe -- Uwe Kleine-König http://www.google.com/search?q=1+stone%3D ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] stash: end commit log with a newline 2007-07-05 11:58 ` Uwe Kleine-König @ 2007-07-05 16:47 ` Junio C Hamano 2007-07-05 23:54 ` しらいしななこ 0 siblings, 1 reply; 12+ messages in thread From: Junio C Hamano @ 2007-07-05 16:47 UTC (permalink / raw) To: Uwe Kleine-König Cc: しらいしななこ, Git Mailing List Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> writes: > I didn't test it yet, but it sounds good. I will apply your patch and > work a while with it. But I think if someone adds documentation, I will > give my Ack. :-) > > BTW: I prefer help over usage, but if it nanako prefers usage, why not > both? We could do that, I guess. Nana? ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] stash: end commit log with a newline 2007-07-05 16:47 ` Junio C Hamano @ 2007-07-05 23:54 ` しらいしななこ 0 siblings, 0 replies; 12+ messages in thread From: しらいしななこ @ 2007-07-05 23:54 UTC (permalink / raw) To: Junio C Hamano; +Cc: Uwe Kleine-König, Git Mailing List Quoting Junio C Hamano <gitster@pobox.com>: > Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> writes: > >> I didn't test it yet, but it sounds good. I will apply your patch and >> work a while with it. But I think if someone adds documentation, I will >> give my Ack. :-) >> >> BTW: I prefer help over usage, but if it nanako prefers usage, why not >> both? > > We could do that, I guess. Nana? Thank you very much for asking. I think it is good to accept both usage and help, then. I will try your patch myself and will report if I can think of further improvements. Please do not expect much documentation from me, however. My writing is not very good. -- Nanako Shiraishi http://ivory.ap.teacup.com/nanako3/ ---------------------------------------------------------------------- Find out how you can get spam free email. http://www.bluebottle.com/tag/3 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] stash: end commit log with a newline @ 2007-07-03 8:59 Uwe Kleine-König 2007-07-03 11:29 ` Johannes Schindelin ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: Uwe Kleine-König @ 2007-07-03 8:59 UTC (permalink / raw) To: Git Mailing List If I do git cat-file commit $commitid for a commit created by stash, the next prompt starts directly after the shortlog of HEAD. Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> --- git-stash.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/git-stash.sh b/git-stash.sh index 16979ab..9deda44 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -67,7 +67,7 @@ save_stash () { die "Cannot save the current worktree state" # create the stash - w_commit=$(printf 'WIP on %s' "$msg" | + w_commit=$(printf 'WIP on %s\n' "$msg" | git commit-tree $w_tree -p $b_commit -p $i_commit) || die "Cannot record working tree state" -- 1.5.2.2.1451.gb0e5e -- Uwe Kleine-König cal 9 1752 | grep 10 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] stash: end commit log with a newline 2007-07-03 8:59 Uwe Kleine-König @ 2007-07-03 11:29 ` Johannes Schindelin 2007-07-03 14:01 ` Uwe Kleine-König 2007-07-03 14:32 ` Jeff King 2007-07-04 5:10 ` しらいしななこ 2007-07-04 5:10 ` Junio C Hamano 2 siblings, 2 replies; 12+ messages in thread From: Johannes Schindelin @ 2007-07-03 11:29 UTC (permalink / raw) To: Uwe Kleine-König; +Cc: Git Mailing List Hi, On Tue, 3 Jul 2007, Uwe Kleine-K?nig wrote: > - w_commit=$(printf 'WIP on %s' "$msg" | > + w_commit=$(printf 'WIP on %s\n' "$msg" | Why not w_commit=$(echo "WIP on $msg" | Hmm? It is shorter and more to the point. IMHO it is also more common. Ciao, Dscho ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] stash: end commit log with a newline 2007-07-03 11:29 ` Johannes Schindelin @ 2007-07-03 14:01 ` Uwe Kleine-König 2007-07-03 14:32 ` Jeff King 1 sibling, 0 replies; 12+ messages in thread From: Uwe Kleine-König @ 2007-07-03 14:01 UTC (permalink / raw) To: Johannes Schindelin; +Cc: Git Mailing List Hallo Johannes, Johannes Schindelin wrote: > On Tue, 3 Jul 2007, Uwe Kleine-K?nig wrote: > > > - w_commit=$(printf 'WIP on %s' "$msg" | > > + w_commit=$(printf 'WIP on %s\n' "$msg" | > > Why not > > w_commit=$(echo "WIP on $msg" | I just continued to use printf to make a minimal change. I don't have anything against echo. Best regards Uwe -- Uwe Kleine-König http://www.google.com/search?q=5%2B7 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] stash: end commit log with a newline 2007-07-03 11:29 ` Johannes Schindelin 2007-07-03 14:01 ` Uwe Kleine-König @ 2007-07-03 14:32 ` Jeff King 1 sibling, 0 replies; 12+ messages in thread From: Jeff King @ 2007-07-03 14:32 UTC (permalink / raw) To: Johannes Schindelin; +Cc: Uwe Kleine-König, Git Mailing List On Tue, Jul 03, 2007 at 12:29:42PM +0100, Johannes Schindelin wrote: > Why not > > w_commit=$(echo "WIP on $msg" | > > Hmm? It is shorter and more to the point. IMHO it is also more common. Because echo cannot reliably reproduce arbitrary strings. See commits: a23bfaed..4b7cc26a You can add this to your list of reasons to rewrite everything in C. -Peff ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] stash: end commit log with a newline 2007-07-03 8:59 Uwe Kleine-König 2007-07-03 11:29 ` Johannes Schindelin @ 2007-07-04 5:10 ` しらいしななこ 2007-07-04 5:10 ` Junio C Hamano 2 siblings, 0 replies; 12+ messages in thread From: しらいしななこ @ 2007-07-04 5:10 UTC (permalink / raw) To: Uwe Kleine-König; +Cc: Git Quoting Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>: > If I do > > git cat-file commit $commitid > > for a commit created by stash, the next prompt starts directly after the > shortlog of HEAD. Thank you for fixing my bug. -- Nanako Shiraishi http://ivory.ap.teacup.com/nanako3/ ---------------------------------------------------------------------- Free pop3 email with a spam filter. http://www.bluebottle.com/tag/5 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] stash: end commit log with a newline 2007-07-03 8:59 Uwe Kleine-König 2007-07-03 11:29 ` Johannes Schindelin 2007-07-04 5:10 ` しらいしななこ @ 2007-07-04 5:10 ` Junio C Hamano 2007-07-04 7:44 ` Uwe Kleine-König 2 siblings, 1 reply; 12+ messages in thread From: Junio C Hamano @ 2007-07-04 5:10 UTC (permalink / raw) To: Uwe Kleine-König; +Cc: Git Mailing List, nanako3 Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> writes: > If I do > > git cat-file commit $commitid > > for a commit created by stash, the next prompt starts directly after the > shortlog of HEAD. Thanks. I noticed another thing. The entries shown in "git stash list" look like this: stash@{0}: js/stash: e1d32c1... Teach git-stash to "apply --index" stash@{1}: master: 5be6007... Rewrite "git-frotz" to "git frotz" stash@{2}: master: 36e5e70... Start deprecating "git-command" in favor of "git command" stash@{3}: master: 3b0d999... Merge branch 'jo/init' But each of the stash is _not_ about these commits, but is about some change that happens to be on top of them. So risking to make it a tad longer, how about doing this on top? --- git-stash.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/git-stash.sh b/git-stash.sh index 9deda44..dd721d2 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -71,7 +71,7 @@ save_stash () { git commit-tree $w_tree -p $b_commit -p $i_commit) || die "Cannot record working tree state" - git update-ref -m "$msg" $ref_stash $w_commit || + git update-ref -m "WIP on $msg" $ref_stash $w_commit || die "Cannot save the current status" printf >&2 'Saved WIP on %s\n' "$msg" } ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] stash: end commit log with a newline 2007-07-04 5:10 ` Junio C Hamano @ 2007-07-04 7:44 ` Uwe Kleine-König 2007-07-04 23:18 ` しらいしななこ 0 siblings, 1 reply; 12+ messages in thread From: Uwe Kleine-König @ 2007-07-04 7:44 UTC (permalink / raw) To: Junio C Hamano; +Cc: Git Mailing List, nanako3 Junio C Hamano wrote: > I noticed another thing. The entries shown in "git stash list" > look like this: > > stash@{0}: js/stash: e1d32c1... Teach git-stash to "apply --index" > stash@{1}: master: 5be6007... Rewrite "git-frotz" to "git frotz" > stash@{2}: master: 36e5e70... Start deprecating "git-command" in favor of "git command" > stash@{3}: master: 3b0d999... Merge branch 'jo/init' > > But each of the stash is _not_ about these commits, but is about > some change that happens to be on top of them. > > So risking to make it a tad longer, how about doing this on top? > > - git update-ref -m "$msg" $ref_stash $w_commit || > + git update-ref -m "WIP on $msg" $ref_stash $w_commit || I like that. I already wondered about that, too. But not as much as thinking about an alternative. So: Acked-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> Best regards Uwe -- Uwe Kleine-König http://www.google.com/search?q=gravity+on+earth%3D ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] stash: end commit log with a newline 2007-07-04 7:44 ` Uwe Kleine-König @ 2007-07-04 23:18 ` しらいしななこ 0 siblings, 0 replies; 12+ messages in thread From: しらいしななこ @ 2007-07-04 23:18 UTC (permalink / raw) To: Uwe Kleine-König; +Cc: Git Mailing List, Junio C Hamano Quoting Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>: > Junio C Hamano wrote: >> I noticed another thing. The entries shown in "git stash list" >> look like this: >> >> stash@{0}: js/stash: e1d32c1... Teach git-stash to "apply --index" >> stash@{1}: master: 5be6007... Rewrite "git-frotz" to "git frotz" >> stash@{2}: master: 36e5e70... Start deprecating "git-command" in favor of "git command" >> stash@{3}: master: 3b0d999... Merge branch 'jo/init' >> >> But each of the stash is _not_ about these commits, but is about >> some change that happens to be on top of them. >> >> So risking to make it a tad longer, how about doing this on top? >> >> - git update-ref -m "$msg" $ref_stash $w_commit || >> + git update-ref -m "WIP on $msg" $ref_stash $w_commit || > > I like that. I already wondered about that, too. But not as much as > thinking about an alternative. > > So: > > Acked-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> I am sorry to join the discussion late, but I think it is much better to let the user give a short reminder message from the command line. For example, $ git stash add customized message to stash When I say "git stash list", I want to see which branch I was on when I was in the middle of doing something, and what that something was. It is not interesting which commit on that branch I started that change from. After creating a stash without a message, and then another stash with a message, I want to see: $ git stash list stash@{0}: On master: add customized message to stash stash@{1}: WIP on master: 36e5e70... Start deprecating "git-command" in favor of "git command" -- Nanako Shiraishi http://ivory.ap.teacup.com/nanako3/ ---------------------------------------------------------------------- Free pop3 email with a spam filter. http://www.bluebottle.com/tag/5 ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2007-07-06 0:02 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <200707042324.l64NOp8I019289@mi0.bluebottle.com> 2007-07-05 5:46 ` [PATCH] stash: end commit log with a newline Junio C Hamano 2007-07-05 11:58 ` Uwe Kleine-König 2007-07-05 16:47 ` Junio C Hamano 2007-07-05 23:54 ` しらいしななこ 2007-07-03 8:59 Uwe Kleine-König 2007-07-03 11:29 ` Johannes Schindelin 2007-07-03 14:01 ` Uwe Kleine-König 2007-07-03 14:32 ` Jeff King 2007-07-04 5:10 ` しらいしななこ 2007-07-04 5:10 ` Junio C Hamano 2007-07-04 7:44 ` Uwe Kleine-König 2007-07-04 23:18 ` しらいしななこ
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).