* [PATCH] git-stash: use git rev-parse -q
@ 2008-12-02 0:56 Miklos Vajna
2008-12-07 23:17 ` Björn Steinbrink
0 siblings, 1 reply; 4+ messages in thread
From: Miklos Vajna @ 2008-12-02 0:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Don't redirect stderr to /dev/null, use -q to suppress the output on
stderr.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
git-stash.sh | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index b9ace99..c0532e8 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -30,7 +30,7 @@ clear_stash () {
then
die "git stash clear with parameters is unimplemented"
fi
- if current=$(git rev-parse --verify $ref_stash 2>/dev/null)
+ if current=$(git rev-parse -q --verify $ref_stash)
then
git update-ref -d $ref_stash $current
fi
@@ -129,7 +129,7 @@ save_stash () {
}
have_stash () {
- git rev-parse --verify $ref_stash >/dev/null 2>&1
+ git rev-parse -q --verify $ref_stash >/dev/null
}
list_stash () {
@@ -229,16 +229,16 @@ drop_stash () {
fi
# Verify supplied argument looks like a stash entry
s=$(git rev-parse --verify "$@") &&
- git rev-parse --verify "$s:" > /dev/null 2>&1 &&
- git rev-parse --verify "$s^1:" > /dev/null 2>&1 &&
- git rev-parse --verify "$s^2:" > /dev/null 2>&1 ||
+ git rev-parse -q --verify "$s:" > /dev/null &&
+ git rev-parse -q --verify "$s^1:" > /dev/null &&
+ git rev-parse -q --verify "$s^2:" > /dev/null ||
die "$*: not a valid stashed state"
git reflog delete --updateref --rewrite "$@" &&
echo "Dropped $* ($s)" || die "$*: Could not drop stash entry"
# clear_stash if we just dropped the last stash entry
- git rev-parse --verify "$ref_stash@{0}" > /dev/null 2>&1 || clear_stash
+ git rev-parse -q --verify "$ref_stash@{0}" > /dev/null || clear_stash
}
apply_to_branch () {
--
1.6.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] git-stash: use git rev-parse -q
2008-12-02 0:56 [PATCH] git-stash: use git rev-parse -q Miklos Vajna
@ 2008-12-07 23:17 ` Björn Steinbrink
2008-12-08 1:42 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Björn Steinbrink @ 2008-12-07 23:17 UTC (permalink / raw)
To: Miklos Vajna; +Cc: Junio C Hamano, git
On 2008.12.02 01:56:09 +0100, Miklos Vajna wrote:
> Don't redirect stderr to /dev/null, use -q to suppress the output on
> stderr.
>
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
>
> # clear_stash if we just dropped the last stash entry
> - git rev-parse --verify "$ref_stash@{0}" > /dev/null 2>&1 || clear_stash
> + git rev-parse -q --verify "$ref_stash@{0}" > /dev/null || clear_stash
This one causes an error message to pop up when the last stash entry is
dropped:
doener@atjola:git (master) $ echo 123 >> Makefile
doener@atjola:git (master) $ git stash
Saved working directory and index state "WIP on master: 2dd6202...
Update draft release notes to 1.6.1"
HEAD is now at 2dd6202 Update draft release notes to 1.6.1
(To restore them type "git stash apply")
doener@atjola:git (master) $ git stash drop
Dropped refs/stash@{0} (e692e43ce03fe0b5f0eb94123123ea61a0f2097a)
fatal: Log .git/logs/refs/stash is empty.
git version 1.6.1.rc1.56.g2dd62
After "git stash drop" finished the rev-parse won't complain anymore,
even if you recreate an empty .git/logs/refs/stash file, because
.git/refs/stash is also gone, and then it doesn't seem to care anymore.
But having a valid ref and an empty log makes it unhappy:
doener@atjola:git (master) $ git rev-parse HEAD > .git/refs/stash
doener@atjola:git (master) $ : > .git/logs/refs/stash
doener@atjola:git (master) $ git rev-parse -q --verify 'refs/stash@{1}'
fatal: Log .git/logs/refs/stash is empty.
Björn
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] git-stash: use git rev-parse -q
2008-12-07 23:17 ` Björn Steinbrink
@ 2008-12-08 1:42 ` Junio C Hamano
2008-12-08 8:46 ` Miklos Vajna
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2008-12-08 1:42 UTC (permalink / raw)
To: Björn Steinbrink; +Cc: Miklos Vajna, git
Thanks; I'll revert this one. Use of -q is simply not worth this
aggravation.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] git-stash: use git rev-parse -q
2008-12-08 1:42 ` Junio C Hamano
@ 2008-12-08 8:46 ` Miklos Vajna
0 siblings, 0 replies; 4+ messages in thread
From: Miklos Vajna @ 2008-12-08 8:46 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Björn Steinbrink, git
[-- Attachment #1: Type: text/plain, Size: 247 bytes --]
On Sun, Dec 07, 2008 at 05:42:46PM -0800, Junio C Hamano <gitster@pobox.com> wrote:
> Thanks; I'll revert this one. Use of -q is simply not worth this
> aggravation.
Sorry, I missed that 2>/dev/null is used for this purpose there as well.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-12-08 8:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02 0:56 [PATCH] git-stash: use git rev-parse -q Miklos Vajna
2008-12-07 23:17 ` Björn Steinbrink
2008-12-08 1:42 ` Junio C Hamano
2008-12-08 8:46 ` Miklos Vajna
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).