Skip to content

Commit 5d4bd79

Browse files
committed
Merge branch 'gh/maint-stash-show-error-message' into maint
* gh/maint-stash-show-error-message: Improve error messages from 'git stash show'
2 parents e80014a + 14cd458 commit 5d4bd79

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

git-stash.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,18 @@ list_stash () {
210210
}
211211

212212
show_stash () {
213+
have_stash || die 'No stash found'
214+
213215
flags=$(git rev-parse --no-revs --flags "$@")
214216
if test -z "$flags"
215217
then
216218
flags=--stat
217219
fi
218220

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+
221225
git diff $flags $b_commit $w_commit
222226
}
223227

0 commit comments

Comments
 (0)