[PATCH] git stash: one bug and one feature request

Subsystems: the rest

DORMANTno replies

7 messages, 7 authors, 2016-06-15 · open the first message on its own page

[PATCH] git stash: one bug and one feature request

From: Marco Costalba <hidden>
Date: 2016-06-15 22:44:02

Currently git-stash writes to stderr also if there is nothing to error
out, also it would be very nice ;-) if git 'stash clear command' would
support deleting of only one patch, so as example to write

stg stash clear stash@{0}

To remove only the last added.


------------------  cut --------------------------

From: Marco Costalba <redacted>
Date: Fri, 4 Jan 2008 17:08:01 +0100
Subject: [PATCH] git-stash: avoid writing to stderr when is not an error

Otherwise git-stash is unusable by scripts that check
stderr to detect fail/success of launched command.

Signed-off-by: Marco Costalba <redacted>
---
 git-stash.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index 06cb177..a05a47a 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -86,7 +86,7 @@ save_stash () {

 	if no_changes
 	then
-		echo >&2 'No local changes to save'
+		echo > 'No local changes to save'
 		exit 0
 	fi
 	test -f "$GIT_DIR/logs/$ref_stash" ||
@@ -99,7 +99,7 @@ save_stash () {

 	git update-ref -m "$stash_msg" $ref_stash $w_commit ||
 		die "Cannot save the current status"
-	printf >&2 'Saved working directory and index state "%s"\n' "$stash_msg"
+	printf > 'Saved working directory and index state "%s"\n' "$stash_msg"
 }

 have_stash () {
@@ -229,7 +229,7 @@ create)
 	if test $# -eq 0
 	then
 		save_stash &&
-		echo >&2 '(To restore them type "git stash apply")' &&
+		echo > '(To restore them type "git stash apply")' &&
 		git-reset --hard
 	else
 		usage
-- 
1.5.4.rc2.18.g530e6

Re: [PATCH] git stash: one bug and one feature request

From: Brandon Casey <hidden>
Date: 2016-06-15 22:44:02

On Fri, 4 Jan 2008, Marco Costalba wrote:
Currently git-stash writes to stderr also if there is nothing to error
out, also it would be very nice ;-) if git 'stash clear command' would
support deleting of only one patch, so as example to write

stg stash clear stash@{0}

To remove only the last added.
Maybe it should be named 'drop'. 'drop' sounds better than
'clear' for this usage.

   git stash drop [<stash>]

Not sure how often such a command would be used though, so
it may not be worth it.

-brandon

Re: [PATCH] git stash: one bug and one feature request

From: Pascal Obry <hidden>
Date: 2016-06-15 22:44:02

Brandon Casey a écrit :
Not sure how often such a command would be used though, so
it may not be worth it.
I've missed it many times. Especially in some scripts when I want to use
the stash-stack to store current working tree and clear it before
exiting. This is not possible today as all the stash-stack would be cleared.

I agree that drop seems better.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

Re: [PATCH] git stash: one bug and one feature request

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:44:02

Pascal Obry [off-list ref] writes:
Brandon Casey a écrit :
quoted
Not sure how often such a command would be used though, so
it may not be worth it.
I've missed it many times. Especially in some scripts when I want to use
the stash-stack to store current working tree and clear it before
exiting. This is not possible today as all the stash-stack would be cleared.

I agree that drop seems better.
or "git stash delete"

This probably would require the command to delete single reflog,
which was posted some time ago and is in either pu or in offcuts,
or in next.

But I guess this is post 1.5.4
-- 
Jakub Narebski
Poland
ShadeHawk on #git

Re: [PATCH] git stash: one bug and one feature request

From: Brian Swetland <hidden>
Date: 2016-06-15 22:44:02

[Jakub Narebski [off-list ref]]
Pascal Obry [off-list ref] writes:
quoted
Brandon Casey a écrit :
quoted
Not sure how often such a command would be used though, so
it may not be worth it.
I've missed it many times. Especially in some scripts when I want to use
the stash-stack to store current working tree and clear it before
exiting. This is not possible today as all the stash-stack would be cleared.

I agree that drop seems better.
or "git stash delete"
Something like drop or delete would be nice.

I tried to "clear" a single stash once. Oops!

Is there a reason that git stash apply couldn't take a small integer
as the argument (at least as an alternative) instead of stash@{0}, etc?

Brian

Re: [PATCH] git stash: one bug and one feature request

From: Jeff King <hidden>
Date: 2016-06-15 22:44:02

On Fri, Jan 04, 2008 at 09:51:05AM -0800, Jakub Narebski wrote:
or "git stash delete"

This probably would require the command to delete single reflog,
which was posted some time ago and is in either pu or in offcuts,
or in next.

But I guess this is post 1.5.4
There is a "git reflog delete" in next (but not in master). See
552cecc2. Using the same name makes sense, since they are equivalent
actions (and "git stash delete" should be very easy, since it is
implemented in terms of reflogs).

-Peff

Re: [PATCH] git stash: one bug and one feature request

From: Wayne Davison <hidden>
Date: 2016-06-15 22:44:02

On Fri, Jan 04, 2008 at 05:14:42PM +0100, Marco Costalba wrote:
-		echo >&2 'No local changes to save'
+		echo > 'No local changes to save'
That change and the other two following it each put a newline in a
strangely named file.  You should just drop the >&2 altogether if you
want the output to go to stdout.

..wayne..
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help