From: Junio C Hamano <gitster@pobox.com>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
junkio@cox.net, git@vger.kernel.org
Subject: Re: [PATCH] Abort mergetool on read error from stdinput
Date: Fri, 03 Dec 2010 11:45:22 -0800 [thread overview]
Message-ID: <7vwrnqod2l.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <70B726FD-EC6A-47B2-9AB1-1CDA3B19358A@dewire.com> (Robin Rosenberg's message of "Fri\, 3 Dec 2010 10\:05\:01 +0100")
Robin Rosenberg <robin.rosenberg@dewire.com> writes:
>> What platform are you on? ^C kills the entire process group here.
>
> Here is a better version and motivation.
>
> -- robin
>
> From 3aa3793a4d1dff940ca6b698a9c01a1fc9bdb9b3 Mon Sep 17 00:00:00 2001
> From: Robin Rosenberg <robin.rosenberg@dewire.com>
> Date: Fri, 3 Dec 2010 09:23:23 +0100
> Subject: [PATCH] Abort mergetool on read error from stdinput
>
> If the mergetool has not quit (by mistake like pressing
> Command-W instead of Command-Q) and the user pressed Ctrl-C
> in the shell that runs mergetool, bash goes into an infinite
> look, at least on Mac OS X. Ctrl-C kills the diff program
> but not the mergetool script.
Interesting. Perhaps the way the script is spawned need to be improved so
that \C-c will do the right thing to avoid this infinite "loop"?
Is "exit 1" the best thing to do here? Doesn't the caller of this
function (or the caller of that caller) want to perform some clean-up
action depending on the answer that comes back from it?
What I am wondering is if it would futureproof us better to set $status to
an appropriate value and break out of the loop, pretending that the end
user gave a reasonable answer (probably "n" but I am just guessing) to
"read answer", instead of dying.
> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
> ---
> git-mergetool--lib.sh | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
> index 77d4aee..1d1413d 100644
> --- a/git-mergetool--lib.sh
> +++ b/git-mergetool--lib.sh
> @@ -35,7 +35,7 @@ check_unchanged () {
> while true; do
> echo "$MERGED seems unchanged."
> printf "Was the merge successful? [y/n] "
> - read answer
> + read answer || exit 1
> case "$answer" in
> y*|Y*) status=0; break ;;
> n*|N*) status=1; break ;;
> --
> 1.7.3.2.452.gb3012.dirty
prev parent reply other threads:[~2010-12-03 19:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-02 6:28 [PATCH] Abort mergetool on read error from stdinput Robin Rosenberg
2010-12-02 6:38 ` Jonathan Nieder
2010-12-03 9:05 ` Robin Rosenberg
2010-12-03 9:14 ` Jonathan Nieder
2010-12-03 19:45 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vwrnqod2l.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=junkio@cox.net \
--cc=robin.rosenberg@dewire.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).