Code

Merge branch 'jc/maint-fix-test-perm' into maint-1.6.6
[git.git] / git-stash.sh
index 3a0685f1893098e8f5c877f509183c8434e7c028..2d691963934c31242512bd4dd349d970c0350243 100755 (executable)
@@ -221,6 +221,7 @@ show_stash () {
 }
 
 apply_stash () {
+       applied_stash=
        unstash_index=
 
        while test $# != 0
@@ -242,6 +243,9 @@ apply_stash () {
        if test $# = 0
        then
                have_stash || die 'Nothing to apply'
+               applied_stash="$ref_stash@{0}"
+       else
+               applied_stash="$*"
        fi
 
        # stash records the work tree, and is a merge between the
@@ -415,8 +419,7 @@ pop)
        shift
        if apply_stash "$@"
        then
-               test -z "$unstash_index" || shift
-               drop_stash "$@"
+               drop_stash "$applied_stash"
        fi
        ;;
 branch)