[PATCH v3 7/9] stash: teach git stash show to always tolerate stash-like arguments.
- From
Jon Seymour <jon.seymour@gmail.com>
- Date
- Aug 8, 2010, 04:46 UTC
- Message-ID
- <1281242771-24764-8-git-send-email-jon.seymour@gmail.com>
- In-Reply-To
- <1281242771-24764-1-git-send-email-jon.seymour@gmail.com>
Previously, git stash show would accept stash-like arguments, but only if there was a stash on the stack.
Now, git stash accepts stash-like arguments always and only fails if no stash-like argument is specified and there is no stash stack.
Signed-off-by: Jon Seymour <jon.seymour@gmail.com> --- git-stash.sh | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh index 97e3749..5b875ea 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -210,14 +210,19 @@ 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 + revs=$(git rev-parse --revs-only "$@") + if test -z "$revs" + then + have_stash || die "No stash found" + set -- ${ref_stash}@{0} + fi + assert_stash_like "$@" git diff $flags $b_commit $w_commit
-- 1.7.2.1.51.g82c0c0