threads / patch / 8830

patchstash: end commit log with a newline

Subject: [PATCH] stash: end commit log with a newline

## tl;dr

8 messages between Jul 3, 2007 and Jul 4, 2007. Diffs are folded; open one to read it.

replies: 7people: 5as markdown or json

Uwe Kleine-König· Jul 3, 2007, 08:59 UTC · lore
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(-)
Show changes to git-stash.sh +1 −1
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
Johannes Schindelin· Jul 3, 2007, 11:29 UTC · re: Uwe Kleine-König · lore

Re: [PATCH] stash: end commit log with a newline

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

Uwe Kleine-König· Jul 3, 2007, 14:01 UTC · re: Johannes Schindelin · lore

Re: [PATCH] stash: end commit log with a newline

Hallo Johannes,
Johannes Schindelin wrote:
Show 8 quoted lines
> 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
Jeff King· Jul 3, 2007, 14:32 UTC · re: Johannes Schindelin · lore

Re: [PATCH] stash: end commit log with a newline

On Tue, Jul 03, 2007 at 12:29:42PM +0100, Johannes Schindelin wrote:
Show 5 quoted lines
> 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
しらいしななこ· Jul 4, 2007, 05:10 UTC · re: Uwe Kleine-König · lore

Re: [PATCH] stash: end commit log with a newline

Quoting Uwe Kleine-König  <ukleinek@informatik.uni-freiburg.de>:
Show 6 quoted lines
> 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
Junio C Hamano· Jul 4, 2007, 05:10 UTC · re: Uwe Kleine-König · lore

Re: [PATCH] stash: end commit log with a newline

Uwe Kleine-König  <ukleinek@informatik.uni-freiburg.de> writes:
Show 6 quoted lines
> 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(-)
Show changes to git-stash.sh +1 −1
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"
 }
Uwe Kleine-König· Jul 4, 2007, 07:44 UTC · re: Junio C Hamano · lore

Re: [PATCH] stash: end commit log with a newline

Junio C Hamano wrote:
Show 15 quoted lines
> 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
しらいしななこ· Jul 4, 2007, 23:18 UTC · re: Uwe Kleine-König · lore

Re: [PATCH] stash: end commit log with a newline

Quoting Uwe Kleine-König  <ukleinek@informatik.uni-freiburg.de>:
Show 23 quoted lines
> 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

← back to recent threads