{"thread":{"id":"16491","subject":"[PATCH 3/3] In add --patch, Handle K,k,J,j slightly more gracefully.","startedAt":"2008-11-27T04:08:03Z","lastAt":"2008-11-27T04:08:03Z","messageCount":1,"participants":["William Pursell"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"96601","messageId":"492E1D23.7010709@gmail.com","threadId":"16491","inReplyTo":null,"subject":"[PATCH 3/3] In add --patch, Handle K,k,J,j slightly more gracefully.","fromName":"William Pursell","fromEmail":"bill.pursell@gmail.com","sentAt":"2008-11-27T04:08:03Z","receivedAt":"2008-11-27T04:08:03Z","isPatch":true,"sender":{"key":"bill.pursell@gmail.com","avatar":"https://gravatar.com/avatar/3ab4313e5dfdc1fedb65206d829ba33f71f56f26e11326979d1b99d5e1c403c9?d=mp&s=160"},"body":"\nInstead of printing the help menu, this will print\n\"No next hunk\" and then process the given hunk again.\n\nSigned-off-by: William Pursell <bill.pursell@gmail.com>\n---\n  git-add--interactive.perl |   43 ++++++++++++++++++++++++++++---------------\n  1 files changed, 28 insertions(+), 15 deletions(-)\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex 547b5c8..66f6629 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -965,29 +965,42 @@ sub patch_update_file {\n  \t\t\telsif ($line =~ m|^/(.*)|) {\n  \t\t\t\t$search_s = qr{$1}m;\n  \t\t\t}\n-\t\t\telsif ($other =~ /K/ && $line =~ /^K/) {\n-\t\t\t\t$ix--;\n+\t\t\telsif ($line =~ /^K/) {\n+\t\t\t\tif ($other =~ /K/) {\n+\t\t\t\t\t$ix--;\n+\t\t\t\t}\n+\t\t\t\telse {\n+\t\t\t\t\tprint STDERR \"No previous hunk\\n\";\n+\t\t\t\t}\n  \t\t\t\tnext;\n  \t\t\t}\n-\t\t\telsif ($other =~ /J/ && $line =~ /^J/) {\n-\t\t\t\t$ix++;\n+\t\t\telsif ($line =~ /^J/) {\n+\t\t\t\tif ($other =~ /J/) {\n+\t\t\t\t\t$ix++;\n+\t\t\t\t}\n+\t\t\t\telse {\n+\t\t\t\t\tprint STDERR \"No next hunk\\n\";\n+\t\t\t\t}\n  \t\t\t\tnext;\n  \t\t\t}\n-\t\t\telsif ($other =~ /k/ && $line =~ /^k/) {\n-\t\t\t\twhile (1) {\n-\t\t\t\t\t$ix--;\n-\t\t\t\t\tlast if (!$ix ||\n-\t\t\t\t\t\t !defined $hunk[$ix]{USE});\n+\t\t\telsif ($line =~ /^k/) {\n+\t\t\t\tif ($other =~ /k/) {\n+\t\t\t\t\twhile (1) {\n+\t\t\t\t\t\t$ix--;\n+\t\t\t\t\t\tlast if (!$ix ||\n+\t\t\t\t\t\t\t !defined $hunk[$ix]{USE});\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\telse {\n+\t\t\t\t\tprint STDERR \"No previous hunk\\n\";\n  \t\t\t\t}\n  \t\t\t\tnext;\n  \t\t\t}\n-\t\t\telsif ($other =~ /j/ && $line =~ /^j/) {\n-\t\t\t\twhile (1) {\n-\t\t\t\t\t$ix++;\n-\t\t\t\t\tlast if ($ix >= $num ||\n-\t\t\t\t\t\t !defined $hunk[$ix]{USE});\n+\t\t\telsif ($line =~ /^j/) {\n+\t\t\t\tif ($other !~ /j/) {\n+\t\t\t\t\tprint STDERR \"No next hunk\\n\";\n+\t\t\t\t\tnext;\n  \t\t\t\t}\n-\t\t\t\tnext;\n  \t\t\t}\n  \t\t\telsif ($other =~ /s/ && $line =~ /^s/) {\n  \t\t\t\tmy @split = split_hunk($hunk[$ix]{TEXT}, $hunk[$ix]{DISPLAY});\n-- \n1.6.0.4.782.geea74.dirty\n\n\n-- \nWilliam Pursell\n"}]}