add -i: revisit hunk on editor failure
authorDeskin Miller <deskinm@umich.edu>
Thu, 12 Feb 2009 05:19:41 +0000 (00:19 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Feb 2009 07:51:15 +0000 (23:51 -0800)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-add--interactive.perl
index 5f129a42030917bc5dcab67aeaf67a5f00c17677..f7b0761732f4a752cc91fd7ca02e3a3e07dcfc17 100755 (executable)
@@ -753,6 +753,10 @@ sub edit_hunk_manually {
                || $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>;