Commits

Anonymous committed 5d4bd79 Merge

Merge branch 'gh/maint-stash-show-error-message' into maint

* gh/maint-stash-show-error-message:
Improve error messages from 'git stash show'

  • Participants
  • Parent commits e80014a, 14cd458

Comments (0)

Files changed (1)

 }
 
 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
 }