git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ross Lagerwall <rosslagerwall@gmail.com>
To: git@vger.kernel.org
Cc: Ross Lagerwall <rosslagerwall@gmail.com>
Subject: [PATCH] stash: don't leak underlying error messages
Date: Wed, 11 Apr 2012 20:36:19 +0200	[thread overview]
Message-ID: <1334169379-20827-1-git-send-email-rosslagerwall@gmail.com> (raw)

When running git-stash on an empty repository, don't let the underlying
error messages leak through to the surface; instead, redirect them to
/dev/null.
---
 git-stash.sh |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index fe4ab28..5c72d1b 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -34,8 +34,8 @@ else
 fi
 
 no_changes () {
-	git diff-index --quiet --cached HEAD --ignore-submodules -- &&
-	git diff-files --quiet --ignore-submodules &&
+	git diff-index --quiet --cached HEAD --ignore-submodules -- 2>/dev/null &&
+	git diff-files --quiet --ignore-submodules 2>/dev/null &&
 	(test -z "$untracked" || test -z "$(untracked_files)")
 }
 
@@ -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 --verify HEAD 2>/dev/null)
 	then
 		head=$(git rev-list --oneline -n 1 HEAD --)
 	else
-- 
1.7.10

             reply	other threads:[~2012-04-11 18:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 18:36 Ross Lagerwall [this message]
2012-04-12 19:30 ` [PATCH] stash: don't leak underlying error messages Junio C Hamano
2012-04-13  3:59   ` Ross Lagerwall

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=1334169379-20827-1-git-send-email-rosslagerwall@gmail.com \
    --to=rosslagerwall@gmail.com \
    --cc=git@vger.kernel.org \
    /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).