Skip to content

Commit

Permalink
Merge branch 'gh/maint-stash-show-error-message' into maint
Browse files Browse the repository at this point in the history
* gh/maint-stash-show-error-message:
  Improve error messages from 'git stash show'
  • Loading branch information
Junio C Hamano committed Apr 10, 2010
2 parents e80014a + 14cd458 commit 5d4bd79
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 5d4bd79

Please sign in to comment.