Add stash apply/pop "--index" option, toggled if there's a prefix arg (C-u) given to 'a' or 'A'

This commit is contained in:
Chris Bernard 2010-09-04 04:35:10 +08:00 committed by Phil Jakckson
parent 4ef20d4061
commit 5299f8aa16
2 changed files with 11 additions and 2 deletions

View file

@ -3575,7 +3575,10 @@ With prefix argument, changes in staging area are kept.
((diff)
(magit-apply-diff-item item))
((stash)
(magit-run-git "stash" "apply" info))))
(apply 'magit-run-git `("stash"
"apply"
,@(when current-prefix-arg '("--index"))
,info)))))
(defun magit-cherry-pick-item ()
(interactive)
@ -3586,7 +3589,10 @@ With prefix argument, changes in staging area are kept.
((commit)
(magit-apply-commit info t))
((stash)
(magit-run-git "stash" "pop" info))))
(apply 'magit-run-git `("stash"
"pop"
,@(when current-prefix-arg '("--index"))
,info)))))
(defun magit-revert-item ()
(interactive)

View file

@ -459,6 +459,9 @@ You can create a new stash with @kbd{z}. Your stashes will be listed
in the status buffer, and you can apply them with @kbd{a} and pop them
with @kbd{A}. To drop a stash, use @kbd{k}.
With a prefix argument, both @kbd{a} and @kbd{A} will attempt to
reinstate the index as well as the working tree from the stash.
Typing @kbd{Z} will create a stash just like @kbd{z}, but will leave
the changes in your working tree and index.