diff options
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-x | git-add--interactive.perl | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 21746d5f28..8f66b825dd 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -76,6 +76,7 @@ my $patch_mode_revision; sub apply_patch; sub apply_patch_for_checkout_commit; +sub apply_patch_for_stash; my %patch_modes = ( 'stage' => { @@ -87,6 +88,15 @@ my %patch_modes = ( PARTICIPLE => 'staging', FILTER => 'file-only', }, + 'stash' => { + DIFF => 'diff-index -p HEAD', + APPLY => sub { apply_patch 'apply --cached', @_; }, + APPLY_CHECK => 'apply --cached', + VERB => 'Stash', + TARGET => '', + PARTICIPLE => 'stashing', + FILTER => undef, + }, 'reset_head' => { DIFF => 'diff-index -p --cached', APPLY => sub { apply_patch 'apply -R --cached', @_; }, @@ -1493,8 +1503,8 @@ sub process_args { 'checkout_head' : 'checkout_nothead'); $arg = shift @ARGV or die "missing --"; } - } elsif ($1 eq 'stage') { - $patch_mode = 'stage'; + } elsif ($1 eq 'stage' or $1 eq 'stash') { + $patch_mode = $1; $arg = shift @ARGV or die "missing --"; } else { die "unknown --patch mode: $1"; |