summaryrefslogtreecommitdiff
path: root/git-add--interactive.perl
diff options
context:
space:
mode:
authorDeskin Miller <deskinm@umich.edu>2009-02-12 05:19:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-02-12 07:51:15 (GMT)
commit1d398a03902aab8ec49197d8827c19f9e2203c98 (patch)
treed36fc2a4712fe6b143067dcf2a30ff80c1062024 /git-add--interactive.perl
parent30aa4fb15fa408596dea59cdc9f00c94eeaa69f1 (diff)
downloadgit-1d398a03902aab8ec49197d8827c19f9e2203c98.zip
git-1d398a03902aab8ec49197d8827c19f9e2203c98.tar.gz
git-1d398a03902aab8ec49197d8827c19f9e2203c98.tar.bz2
add -i: revisit hunk on editor failure
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>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl4
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>;