{"thread":{"id":"25571","subject":"[PATCH] Correct help blurb in checkout -p and friends","startedAt":"2010-10-28T00:49:20Z","lastAt":"2010-10-28T00:53:18Z","messageCount":2,"participants":["Jonathan \"Duke\" Leto","Thomas Rast"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"154595","messageId":"1288226960-31584-1-git-send-email-jonathan@leto.net","threadId":"25571","inReplyTo":null,"subject":"[PATCH] Correct help blurb in checkout -p and friends","fromName":"Jonathan \"Duke\" Leto","fromEmail":"jonathan@leto.net","sentAt":"2010-10-28T00:49:20Z","receivedAt":"2010-10-28T00:49:20Z","isPatch":true,"sender":{"key":"jonathan@leto.net","avatar":"https://avatars.githubusercontent.com/u/30298?v=4"},"body":"When git checkout -p from the index or HEAD is run in edit mode, the\nhelp message about removing '-' and '+' lines was backwards. Because it\nis reverse applying the patch, the meanings of '-' and '+' are reversed.\n\nSigned-off-by: Jonathan \"Duke\" Leto <jonathan@leto.net>\n---\n git-add--interactive.perl |   13 +++++++++++--\n 1 files changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex 77f60fa..a329c5a 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -89,6 +89,7 @@ my %patch_modes = (\n \t\tTARGET => '',\n \t\tPARTICIPLE => 'staging',\n \t\tFILTER => 'file-only',\n+\t\tIS_REVERSE => 0,\n \t},\n \t'stash' => {\n \t\tDIFF => 'diff-index -p HEAD',\n@@ -98,6 +99,7 @@ my %patch_modes = (\n \t\tTARGET => '',\n \t\tPARTICIPLE => 'stashing',\n \t\tFILTER => undef,\n+\t\tIS_REVERSE => 0,\n \t},\n \t'reset_head' => {\n \t\tDIFF => 'diff-index -p --cached',\n@@ -107,6 +109,7 @@ my %patch_modes = (\n \t\tTARGET => '',\n \t\tPARTICIPLE => 'unstaging',\n \t\tFILTER => 'index-only',\n+\t\tIS_REVERSE => 1,\n \t},\n \t'reset_nothead' => {\n \t\tDIFF => 'diff-index -R -p --cached',\n@@ -116,6 +119,7 @@ my %patch_modes = (\n \t\tTARGET => ' to index',\n \t\tPARTICIPLE => 'applying',\n \t\tFILTER => 'index-only',\n+\t\tIS_REVERSE => 0,\n \t},\n \t'checkout_index' => {\n \t\tDIFF => 'diff-files -p',\n@@ -125,6 +129,7 @@ my %patch_modes = (\n \t\tTARGET => ' from worktree',\n \t\tPARTICIPLE => 'discarding',\n \t\tFILTER => 'file-only',\n+\t\tIS_REVERSE => 1,\n \t},\n \t'checkout_head' => {\n \t\tDIFF => 'diff-index -p',\n@@ -134,6 +139,7 @@ my %patch_modes = (\n \t\tTARGET => ' from index and worktree',\n \t\tPARTICIPLE => 'discarding',\n \t\tFILTER => undef,\n+\t\tIS_REVERSE => 1,\n \t},\n \t'checkout_nothead' => {\n \t\tDIFF => 'diff-index -R -p',\n@@ -143,6 +149,7 @@ my %patch_modes = (\n \t\tTARGET => ' to index and worktree',\n \t\tPARTICIPLE => 'applying',\n \t\tFILTER => undef,\n+\t\tIS_REVERSE => 0,\n \t},\n );\n \n@@ -1001,10 +1008,12 @@ sub edit_hunk_manually {\n \tprint $fh \"# Manual hunk edit mode -- see bottom for a quick guide\\n\";\n \tprint $fh @$oldtext;\n \tmy $participle = $patch_mode_flavour{PARTICIPLE};\n+\tmy $is_reverse = $patch_mode_flavour{IS_REVERSE};\n+\tmy ($remove_plus, $remove_minus) = $is_reverse ? ('-', '+') : ('+', '-');\n \tprint $fh <<EOF;\n # ---\n-# To remove '-' lines, make them ' ' lines (context).\n-# To remove '+' lines, delete them.\n+# To remove '$remove_minus' lines, make them ' ' lines (context).\n+# To remove '$remove_plus' lines, delete them.\n # Lines starting with # will be removed.\n #\n # If the patch applies cleanly, the edited hunk will immediately be\n-- \n1.7.0.4\n"},{"id":"154597","messageId":"201010280253.18833.trast@student.ethz.ch","threadId":"25571","inReplyTo":"1288226960-31584-1-git-send-email-jonathan@leto.net","subject":"Re: [PATCH] Correct help blurb in checkout -p and friends","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-10-28T00:53:18Z","receivedAt":"2010-10-28T00:53:18Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Jonathan \"Duke\" Leto wrote:\n> When git checkout -p from the index or HEAD is run in edit mode, the\n> help message about removing '-' and '+' lines was backwards. Because it\n> is reverse applying the patch, the meanings of '-' and '+' are reversed.\n> \n> Signed-off-by: Jonathan \"Duke\" Leto <jonathan@leto.net>\n\nAcked-by: Thomas Rast <trast@student.ethz.ch>\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"}]}