# [PATCH] add -i: revisit hunk on editor failure

1 messages from 2009-02-12 to 2009-02-12. Participants: Deskin Miller.
Thread: https://gitlist.dev/t/17737

## Deskin Miller, 2009-02-12 05:19

Subject: [PATCH] add -i: revisit hunk on editor failure
Message-ID: <1234415981-22789-1-git-send-email-deskinm@umich.edu>
URL: https://gitlist.dev/e/1234415981-22789-1-git-send-email-deskinm%40umich.edu

```
Similar to the behaviour for editing a commit message, let terminating
the editor with a failure abort the current hunk edit and revisit the
option selection for the hunk.

Signed-off-by: Deskin Miller <deskinm@umich.edu>
---
I find it much easier to type :cq in vi than to read the helpful
message that's in the comments and then delete all the hunk lines.
Besides, I already learned how to abort a commit message this way.

Deskin Miller

 git-add--interactive.perl |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 5f129a4..f7b0761 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -753,6 +753,10 @@ EOF
 		|| $ENV{VISUAL} || $ENV{EDITOR} || "vi";
 	system('sh', '-c', $editor.' "$@"', $editor, $hunkfile);
 
+	if ($? != 0) {
+		return undef;
+	}
+
 	open $fh, '<', $hunkfile
 		or die "failed to open hunk edit file for reading: " . $!;
 	my @newtext = grep { !/^#/ } <$fh>;
-- 
1.6.1.399.g0d272

```
