Code

Merge branch 'jl/add-p-reverse-message'
authorJunio C Hamano <gitster@pobox.com>
Tue, 30 Nov 2010 01:52:34 +0000 (17:52 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Nov 2010 01:52:34 +0000 (17:52 -0800)
* jl/add-p-reverse-message:
  Correct help blurb in checkout -p and friends

1  2 
git-add--interactive.perl

index 77f60fa3960323e412f8d09968e63865cc639298,406beb5c507b6fc0e9bc855cfab784b7570342ab..a329c5a1f8c3b63ee6976a8e0e3903a11783324b
@@@ -1,8 -1,6 +1,8 @@@
 -#!/usr/bin/perl -w
 +#!/usr/bin/perl
  
 +use 5.008;
  use strict;
 +use warnings;
  use Git;
  
  binmode(STDOUT, ":raw");
@@@ -89,6 -87,7 +89,7 @@@ my %patch_modes = 
                TARGET => '',
                PARTICIPLE => 'staging',
                FILTER => 'file-only',
+               IS_REVERSE => 0,
        },
        'stash' => {
                DIFF => 'diff-index -p HEAD',
@@@ -98,6 -97,7 +99,7 @@@
                TARGET => '',
                PARTICIPLE => 'stashing',
                FILTER => undef,
+               IS_REVERSE => 0,
        },
        'reset_head' => {
                DIFF => 'diff-index -p --cached',
                TARGET => '',
                PARTICIPLE => 'unstaging',
                FILTER => 'index-only',
+               IS_REVERSE => 1,
        },
        'reset_nothead' => {
                DIFF => 'diff-index -R -p --cached',
                TARGET => ' to index',
                PARTICIPLE => 'applying',
                FILTER => 'index-only',
+               IS_REVERSE => 0,
        },
        'checkout_index' => {
                DIFF => 'diff-files -p',
                TARGET => ' from worktree',
                PARTICIPLE => 'discarding',
                FILTER => 'file-only',
+               IS_REVERSE => 1,
        },
        'checkout_head' => {
                DIFF => 'diff-index -p',
                TARGET => ' from index and worktree',
                PARTICIPLE => 'discarding',
                FILTER => undef,
+               IS_REVERSE => 1,
        },
        'checkout_nothead' => {
                DIFF => 'diff-index -R -p',
                TARGET => ' to index and worktree',
                PARTICIPLE => 'applying',
                FILTER => undef,
+               IS_REVERSE => 0,
        },
  );
  
@@@ -1001,10 -1006,12 +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