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>
Gustaf Hendeby committed
Mar 16, 2010 at 18:52 UTC
14cd458126c7c70f8cf180861e3db5ed3b788813
1 file changed
+6
-2
git-stash.sh
+6
-2
@@ -210,14 +210,18 @@ list_stash () {
210
}
211
212
show_stash () {
213
+ have_stash || die 'No stash found'
214
+
215
flags=$(git rev-parse --no-revs --flags "$@")
216
if test -z "$flags"
217
then
218
flags=--stat
219
fi
220
219
- w_commit=$(git rev-parse --verify --default $ref_stash "$@") &&
220
- b_commit=$(git rev-parse --verify "$w_commit^") &&
221
+ w_commit=$(git rev-parse --quiet --verify --default $ref_stash "$@") &&
222
+ b_commit=$(git rev-parse --quiet --verify "$w_commit^") ||
223
+ die "'$*' is not a stash"
224
+
225
git diff $flags $b_commit $w_commit
226
}
227