Skip to content

Commit

Permalink
Merge branch 'jl/add-p-reverse-message'
Browse files Browse the repository at this point in the history
* jl/add-p-reverse-message:
  Correct help blurb in checkout -p and friends
  • Loading branch information
Junio C Hamano committed Nov 30, 2010
2 parents 09efc45 + 7b8c705 commit 1aa6583
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ sub colored {
TARGET => '',
PARTICIPLE => 'staging',
FILTER => 'file-only',
IS_REVERSE => 0,
},
'stash' => {
DIFF => 'diff-index -p HEAD',
Expand All @@ -98,6 +99,7 @@ sub colored {
TARGET => '',
PARTICIPLE => 'stashing',
FILTER => undef,
IS_REVERSE => 0,
},
'reset_head' => {
DIFF => 'diff-index -p --cached',
Expand All @@ -107,6 +109,7 @@ sub colored {
TARGET => '',
PARTICIPLE => 'unstaging',
FILTER => 'index-only',
IS_REVERSE => 1,
},
'reset_nothead' => {
DIFF => 'diff-index -R -p --cached',
Expand All @@ -116,6 +119,7 @@ sub colored {
TARGET => ' to index',
PARTICIPLE => 'applying',
FILTER => 'index-only',
IS_REVERSE => 0,
},
'checkout_index' => {
DIFF => 'diff-files -p',
Expand All @@ -125,6 +129,7 @@ sub colored {
TARGET => ' from worktree',
PARTICIPLE => 'discarding',
FILTER => 'file-only',
IS_REVERSE => 1,
},
'checkout_head' => {
DIFF => 'diff-index -p',
Expand All @@ -134,6 +139,7 @@ sub colored {
TARGET => ' from index and worktree',
PARTICIPLE => 'discarding',
FILTER => undef,
IS_REVERSE => 1,
},
'checkout_nothead' => {
DIFF => 'diff-index -R -p',
Expand All @@ -143,6 +149,7 @@ sub colored {
TARGET => ' to index and worktree',
PARTICIPLE => 'applying',
FILTER => undef,
IS_REVERSE => 0,
},
);

Expand Down Expand Up @@ -1001,10 +1008,12 @@ sub edit_hunk_manually {
print $fh "# Manual hunk edit mode -- see bottom for a quick guide\n";
print $fh @$oldtext;
my $participle = $patch_mode_flavour{PARTICIPLE};
my $is_reverse = $patch_mode_flavour{IS_REVERSE};
my ($remove_plus, $remove_minus) = $is_reverse ? ('-', '+') : ('+', '-');
print $fh <<EOF;
# ---
# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# To remove '$remove_minus' lines, make them ' ' lines (context).
# To remove '$remove_plus' lines, delete them.
# Lines starting with # will be removed.
#
# If the patch applies cleanly, the edited hunk will immediately be
Expand Down

0 comments on commit 1aa6583

Please sign in to comment.