From: Gustaf Hendeby Date: Tue, 16 Mar 2010 17:52:37 +0000 (+0100) Subject: Improve error messages from 'git stash show' X-Git-Tag: v1.7.1-rc0~20^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=14cd458126c7c70f8cf180861e3db5ed3b788813;p=git.git Improve error messages from 'git stash show' The previous error message "fatal: Needed a single revision" is not very informative. Signed-off-by: Gustaf Hendeby Signed-off-by: Junio C Hamano --- diff --git a/git-stash.sh b/git-stash.sh index aa47e541e..59db3dc38 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 "'$*' is not a stash" + git diff $flags $b_commit $w_commit }