detached-stash: refactor git stash pop implementation
[gitweb.git] / git-stash.sh
index 750f360da9730423fde863de391ecbe550b172cf..ac4c0f69cf4ede9ab1cfadcbd09f3114f08ab9d3 100755 (executable)
@@ -423,6 +423,13 @@ apply_stash () {
        fi
 }
 
+pop_stash() {
+       assert_stash_ref "$@"
+
+       apply_stash "$@" &&
+       drop_stash "$@"
+}
+
 drop_stash () {
        assert_stash_ref "$@"
 
@@ -498,10 +505,7 @@ drop)
        ;;
 pop)
        shift
-       if apply_stash "$@"
-       then
-               drop_stash "$applied_stash"
-       fi
+       pop_stash "$@"
        ;;
 branch)
        shift