aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-04-09 22:22:14 -0700
committerJunio C Hamano <gitster@pobox.com>2010-04-09 22:22:14 -0700
commit5d4bd79d8002ee199c6561b2a10466c347caf2fa (patch)
tree0eeaa348219fd98b4b89178500fcd5f6551cf081
parente80014a13e86f47a172620567608e627427ceeeb (diff)
parent14cd458126c7c70f8cf180861e3db5ed3b788813 (diff)
downloadgit-5d4bd79d8002ee199c6561b2a10466c347caf2fa.tar.gz
git-5d4bd79d8002ee199c6561b2a10466c347caf2fa.tar.xz
Merge branch 'gh/maint-stash-show-error-message' into maint
* gh/maint-stash-show-error-message: Improve error messages from 'git stash show'
-rwxr-xr-xgit-stash.sh8
1 files changed, 6 insertions, 2 deletions
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
}