Skip to content

Commit

Permalink
add -i: revisit hunk on editor failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Deskin Miller authored and Junio C Hamano committed Feb 12, 2009
1 parent 30aa4fb commit 1d398a0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down

0 comments on commit 1d398a0

Please sign in to comment.