diff options
author | Jonathan "Duke" Leto <jonathan@leto.net> | 2010-10-27 17:49:20 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-10-28 15:28:39 -0700 |
commit | 7b8c70518894db9c6376913be04c2c8bf9827e4d (patch) | |
tree | 4d302092ebe4e5b83f65039db458bb6b81e0c79c /git-add--interactive.perl | |
parent | 8a90438506d3b7c8ef8bd802b7ed10c1f12da1d0 (diff) | |
download | git-7b8c70518894db9c6376913be04c2c8bf9827e4d.tar.gz |
Correct help blurb in checkout -p and friends
When git checkout -p from the index or HEAD is run in edit mode, the
help message about removing '-' and '+' lines was backwards. Because it
is reverse applying the patch, the meanings of '-' and '+' are reversed.
Signed-off-by: Jonathan "Duke" Leto <jonathan@leto.net>
Acked-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-x | git-add--interactive.perl | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 27fc79347a..406beb5c50 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -87,6 +87,7 @@ my %patch_modes = ( TARGET => '', PARTICIPLE => 'staging', FILTER => 'file-only', + IS_REVERSE => 0, }, 'stash' => { DIFF => 'diff-index -p HEAD', @@ -96,6 +97,7 @@ my %patch_modes = ( TARGET => '', PARTICIPLE => 'stashing', FILTER => undef, + IS_REVERSE => 0, }, 'reset_head' => { DIFF => 'diff-index -p --cached', @@ -105,6 +107,7 @@ my %patch_modes = ( TARGET => '', PARTICIPLE => 'unstaging', FILTER => 'index-only', + IS_REVERSE => 1, }, 'reset_nothead' => { DIFF => 'diff-index -R -p --cached', @@ -114,6 +117,7 @@ my %patch_modes = ( TARGET => ' to index', PARTICIPLE => 'applying', FILTER => 'index-only', + IS_REVERSE => 0, }, 'checkout_index' => { DIFF => 'diff-files -p', @@ -123,6 +127,7 @@ my %patch_modes = ( TARGET => ' from worktree', PARTICIPLE => 'discarding', FILTER => 'file-only', + IS_REVERSE => 1, }, 'checkout_head' => { DIFF => 'diff-index -p', @@ -132,6 +137,7 @@ my %patch_modes = ( TARGET => ' from index and worktree', PARTICIPLE => 'discarding', FILTER => undef, + IS_REVERSE => 1, }, 'checkout_nothead' => { DIFF => 'diff-index -R -p', @@ -141,6 +147,7 @@ my %patch_modes = ( TARGET => ' to index and worktree', PARTICIPLE => 'applying', FILTER => undef, + IS_REVERSE => 0, }, ); @@ -999,10 +1006,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 |