git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add -i: revisit hunk on editor failure
@ 2009-02-12  5:19 Deskin Miller
  0 siblings, 0 replies; only message in thread
From: Deskin Miller @ 2009-02-12  5:19 UTC (permalink / raw)
  To: git; +Cc: gitster, Deskin Miller

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-12  5:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-12  5:19 [PATCH] add -i: revisit hunk on editor failure Deskin Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).