From: David Aguilar <davvid@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Christian Couder" <chriscool@tuxfamily.org>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Jon Seymour" <jon.seymour@gmail.com>
Subject: [PATCH 2/2] stash: prefer --quiet over shell redirection
Date: Sat, 30 Aug 2014 12:30:29 -0700 [thread overview]
Message-ID: <1409427029-65886-2-git-send-email-davvid@gmail.com> (raw)
In-Reply-To: <1409427029-65886-1-git-send-email-davvid@gmail.com>
Use `git rev-parse --quiet` instead of redirecting to /dev/null.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
git-stash.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index bcc757b..5a5185b 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -50,7 +50,7 @@ clear_stash () {
then
die "$(gettext "git stash clear with parameters is unimplemented")"
fi
- if current=$(git rev-parse --verify $ref_stash 2>/dev/null)
+ if current=$(git rev-parse --quiet --verify $ref_stash)
then
git update-ref -d $ref_stash $current
fi
@@ -67,7 +67,7 @@ create_stash () {
fi
# state of the base commit
- if b_commit=$(git rev-parse --verify HEAD)
+ if b_commit=$(git rev-parse --quiet --verify HEAD)
then
head=$(git rev-list --oneline -n 1 HEAD --)
else
@@ -292,7 +292,7 @@ save_stash () {
}
have_stash () {
- git rev-parse --verify $ref_stash >/dev/null 2>&1
+ git rev-parse --quiet --verify $ref_stash
}
list_stash () {
@@ -392,12 +392,12 @@ parse_flags_and_rev()
;;
esac
- REV=$(git rev-parse --quiet --symbolic --verify "$1" 2>/dev/null) || {
+ REV=$(git rev-parse --quiet --symbolic --verify "$1") || {
reference="$1"
die "$(eval_gettext "\$reference is not valid reference")"
}
- i_commit=$(git rev-parse --quiet --verify "$REV^2" 2>/dev/null) &&
+ i_commit=$(git rev-parse --quiet --verify "$REV^2") &&
set -- $(git rev-parse "$REV" "$REV^1" "$REV:" "$REV^1:" "$REV^2:" 2>/dev/null) &&
s=$1 &&
w_commit=$1 &&
@@ -409,7 +409,7 @@ parse_flags_and_rev()
test "$ref_stash" = "$(git rev-parse --symbolic-full-name "${REV%@*}")" &&
IS_STASH_REF=t
- u_commit=$(git rev-parse --quiet --verify "$REV^3" 2>/dev/null) &&
+ u_commit=$(git rev-parse --quiet --verify "$REV^3") &&
u_tree=$(git rev-parse "$REV^3:" 2>/dev/null)
}
@@ -531,7 +531,7 @@ drop_stash () {
die "$(eval_gettext "\${REV}: 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 --quiet --verify "$ref_stash@{0}" || clear_stash
}
apply_to_branch () {
--
2.1.0.29.g9b751c4
next prev parent reply other threads:[~2014-08-30 19:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-30 19:30 [PATCH 1/2] bisect: remove unnecessary redirection David Aguilar
2014-08-30 19:30 ` David Aguilar [this message]
2014-08-30 21:07 ` [PATCH 2/2] stash: prefer --quiet over shell redirection Johannes Sixt
2014-08-31 7:35 ` David Aguilar
2014-08-30 20:57 ` [PATCH 1/2] bisect: remove unnecessary redirection Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409427029-65886-2-git-send-email-davvid@gmail.com \
--to=davvid@gmail.com \
--cc=avarab@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jon.seymour@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).