Commit 14cd4581 authored by Gustaf Hendeby's avatar Gustaf Hendeby Committed by Junio C Hamano

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's avatarGustaf Hendeby <hendeby@isy.liu.se>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 8fcaca3f
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment