{"thread":{"id":"17737","subject":"[PATCH] add -i: revisit hunk on editor failure","startedAt":"2009-02-12T05:19:41Z","lastAt":"2009-02-12T05:19:41Z","messageCount":1,"participants":["Deskin Miller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"104344","messageId":"1234415981-22789-1-git-send-email-deskinm@umich.edu","threadId":"17737","inReplyTo":null,"subject":"[PATCH] add -i: revisit hunk on editor failure","fromName":"Deskin Miller","fromEmail":"deskinm@umich.edu","sentAt":"2009-02-12T05:19:41Z","receivedAt":"2009-02-12T05:19:41Z","isPatch":true,"sender":{"key":"deskinm@umich.edu","avatar":"https://gravatar.com/avatar/d340a0e612cdf0a79535c71863c0b4c535e9aba63b42032226ae903e638b64f9?d=mp&s=160"},"body":"Similar to the behaviour for editing a commit message, let terminating\nthe editor with a failure abort the current hunk edit and revisit the\noption selection for the hunk.\n\nSigned-off-by: Deskin Miller <deskinm@umich.edu>\n---\nI find it much easier to type :cq in vi than to read the helpful\nmessage that's in the comments and then delete all the hunk lines.\nBesides, I already learned how to abort a commit message this way.\n\nDeskin Miller\n\n git-add--interactive.perl |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex 5f129a4..f7b0761 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -753,6 +753,10 @@ EOF\n \t\t|| $ENV{VISUAL} || $ENV{EDITOR} || \"vi\";\n \tsystem('sh', '-c', $editor.' \"$@\"', $editor, $hunkfile);\n \n+\tif ($? != 0) {\n+\t\treturn undef;\n+\t}\n+\n \topen $fh, '<', $hunkfile\n \t\tor die \"failed to open hunk edit file for reading: \" . $!;\n \tmy @newtext = grep { !/^#/ } <$fh>;\n-- \n1.6.1.399.g0d272\n"}]}