Skip to content

Commit 11cf80d

Browse files
committed
Merge branch 'jl/add-p-reverse-message' into maint
* jl/add-p-reverse-message: Correct help blurb in checkout -p and friends
2 parents 8577def + 7b8c705 commit 11cf80d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

git-add--interactive.perl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ sub colored {
8989
TARGET => '',
9090
PARTICIPLE => 'staging',
9191
FILTER => 'file-only',
92+
IS_REVERSE => 0,
9293
},
9394
'stash' => {
9495
DIFF => 'diff-index -p HEAD',
@@ -98,6 +99,7 @@ sub colored {
9899
TARGET => '',
99100
PARTICIPLE => 'stashing',
100101
FILTER => undef,
102+
IS_REVERSE => 0,
101103
},
102104
'reset_head' => {
103105
DIFF => 'diff-index -p --cached',
@@ -107,6 +109,7 @@ sub colored {
107109
TARGET => '',
108110
PARTICIPLE => 'unstaging',
109111
FILTER => 'index-only',
112+
IS_REVERSE => 1,
110113
},
111114
'reset_nothead' => {
112115
DIFF => 'diff-index -R -p --cached',
@@ -116,6 +119,7 @@ sub colored {
116119
TARGET => ' to index',
117120
PARTICIPLE => 'applying',
118121
FILTER => 'index-only',
122+
IS_REVERSE => 0,
119123
},
120124
'checkout_index' => {
121125
DIFF => 'diff-files -p',
@@ -125,6 +129,7 @@ sub colored {
125129
TARGET => ' from worktree',
126130
PARTICIPLE => 'discarding',
127131
FILTER => 'file-only',
132+
IS_REVERSE => 1,
128133
},
129134
'checkout_head' => {
130135
DIFF => 'diff-index -p',
@@ -134,6 +139,7 @@ sub colored {
134139
TARGET => ' from index and worktree',
135140
PARTICIPLE => 'discarding',
136141
FILTER => undef,
142+
IS_REVERSE => 1,
137143
},
138144
'checkout_nothead' => {
139145
DIFF => 'diff-index -R -p',
@@ -143,6 +149,7 @@ sub colored {
143149
TARGET => ' to index and worktree',
144150
PARTICIPLE => 'applying',
145151
FILTER => undef,
152+
IS_REVERSE => 0,
146153
},
147154
);
148155

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

0 commit comments

Comments
 (0)