DORMANTno replies

[PATCH] stash: don't leak underlying error messages

From: Ross Lagerwall <hidden>
Date: 2016-06-15 22:53:33
Subsystem: the rest · Maintainer: Linus Torvalds

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help