DORMANTno replies

[PATCH 1/1] Improve error messages from 'git stash show'

From: Gustaf Hendeby <hidden>
Date: 2016-06-15 22:48:26
Subsystem: the rest · Maintainer: Linus Torvalds

The previous error message "fatal: Needed a single revision" is not
very informative.

Signed-off-by: Gustaf Hendeby <redacted>
---
 git-stash.sh |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index aa47e54..cf221c6 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -210,14 +210,18 @@ list_stash () {
 }
 
 show_stash () {
+	have_stash || die 'No stash found'
+
 	flags=$(git rev-parse --no-revs --flags "$@")
 	if test -z "$flags"
 	then
 		flags=--stat
 	fi
 
-	w_commit=$(git rev-parse --verify --default $ref_stash "$@") &&
-	b_commit=$(git rev-parse --verify "$w_commit^") &&
+	w_commit=$(git rev-parse --quiet --verify --default $ref_stash "$@") &&
+	b_commit=$(git rev-parse --quiet --verify "$w_commit^") ||
+		die 'Stash not found'
+
 	git diff $flags $b_commit $w_commit
 }
 
-- 
1.7.0.2.274.gc376e.dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help