merge-recursive: Make room for directories in D/F conflicts
[gitweb.git] / git-stash.sh
index ac4c0f69cf4ede9ab1cfadcbd09f3114f08ab9d3..7ce818bd1baecfb48447f862bb2654ccbd3cf2ff 100755 (executable)
@@ -210,19 +210,9 @@ 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 --quiet --verify --default $ref_stash "$@") &&
-       b_commit=$(git rev-parse --quiet --verify "$w_commit^") ||
-               die "'$*' is not a stash"
+       assert_stash_like "$@"
 
-       git diff $flags $b_commit $w_commit
+       git diff ${FLAGS:---stat} $b_commit $w_commit
 }
 
 #
@@ -441,20 +431,17 @@ drop_stash () {
 }
 
 apply_to_branch () {
-       have_stash || die 'Nothing to apply'
-
        test -n "$1" || die 'No branch name specified'
        branch=$1
+       shift 1
 
-       if test -z "$2"
-       then
-               set x "$ref_stash@{0}"
-       fi
-       stash=$2
+       set -- --index "$@"
+       assert_stash_like "$@"
+
+       git checkout -b $branch $REV^ &&
+       apply_stash "$@"
 
-       git checkout -b $branch $stash^ &&
-       apply_stash --index $stash &&
-       drop_stash $stash
+       test -z "$IS_STASH_REF" || drop_stash "$@"
 }
 
 PARSE_CACHE='--not-parsed'