summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-04-03 12:28:40 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-04-03 12:28:40 -0700
commitf40805be218bd7163687c4982b6327876c82a897 (patch)
tree31686561bef97cba09eda9ac85c758bebf29bf7e
parentMerge branch 'rs/threaded-grep-context' (diff)
parentImprove error messages from 'git stash show' (diff)
downloadtgif-f40805be218bd7163687c4982b6327876c82a897.tar.xz
Merge branch 'gh/maint-stash-show-error-message'
* 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 aa47e541ee..59db3dc38e 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
}