summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorGustaf Hendeby <hendeby@isy.liu.se>2010-03-16 17:52:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-03-17 02:23:24 (GMT)
commit14cd458126c7c70f8cf180861e3db5ed3b788813 (patch)
tree50318726039a6f09ba061c0fef51f607930ae48c /git-stash.sh
parent8fcaca3ff29a193f50a44bb3d5734a503e0539a6 (diff)
downloadgit-14cd458126c7c70f8cf180861e3db5ed3b788813.zip
git-14cd458126c7c70f8cf180861e3db5ed3b788813.tar.gz
git-14cd458126c7c70f8cf180861e3db5ed3b788813.tar.bz2
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 <hendeby@isy.liu.se> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/git-stash.sh b/git-stash.sh
index aa47e54..59db3dc 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
}