From: Jay Soffian <jaysoffian@gmail.com>
To: git@vger.kernel.org
Cc: Jay Soffian <jaysoffian@gmail.com>,
Matthieu Moy <Matthieu.Moy@imag.fr>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 1/2] send-email: refactor and ensure prompting doesn't loop forever
Date: Sat, 28 Mar 2009 21:48:29 -0400 [thread overview]
Message-ID: <76718490903281848l5102afc3x89eed40ed6083dcc@mail.gmail.com> (raw)
In-Reply-To: <1238290751-57461-1-git-send-email-jaysoffian@gmail.com>
On Sat, Mar 28, 2009 at 9:39 PM, Jay Soffian <jaysoffian@gmail.com> wrote:
> There are three callers of the function:
Where by "three" I mean "four". Please use this commit message instead:
---snip---
Several places in send-email prompt for input, and will do so forever
when the input is EOF. This is poor behavior when send-email is run
unattended (say from cron).
This patch refactors the prompting to an ask() function which takes a
prompt, an optional default, and an optional regex to validate the
input. The function returns on EOF, or if a default is provided and the
user simply types return, or if the input passes the validating regex
(which accepts all input by default). The ask() function gives up after
10 tries in case of invalid input.
There are four callers of the function:
1) "Who should the emails appear to be from?" which provides a default
sender. Previously the user would have to type ctrl-d to accept the
default. Now the user can just hit return, or type ctrl-d.
2) "Who should the emails be sent to?". Previously this prompt passed a
second argument ("") to $term->readline() which was ignored. I believe
the intent was to allow the user to just hit return. Now the user
can do so, or type ctrl-d.
3) "Message-ID to be used as In-Reply-To for the first email?".
Previously this prompt passed a second argument (effectively undef) to
$term->readline() which was ignored. I believe the intent was the same
as for (2), to allow the user to just hit return. Now the user can do
so, or type ctrl-d.
4) "Send this email?". Previously this prompt would loop forever until
it got a valid reply. Now it stops prompting on EOF or a valid reply. In
the case where confirm = "inform", it now defaults to "y" on EOF or the
user hitting return, otherwise an invalid reply causes send-email to
terminate.
A followup patch adds tests for the new functionality.
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---snip---
Thanks,
j.
next prev parent reply other threads:[~2009-03-29 1:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-29 1:39 [PATCH 1/2] send-email: refactor and ensure prompting doesn't loop forever Jay Soffian
2009-03-29 1:39 ` [PATCH 2/2] send-email: add tests for refactored prompting Jay Soffian
2009-03-31 10:33 ` Björn Steinbrink
2009-03-31 13:58 ` Jay Soffian
2009-03-31 14:07 ` Jay Soffian
2009-03-31 14:19 ` Björn Steinbrink
2009-03-31 14:36 ` Jay Soffian
2009-03-29 1:48 ` Jay Soffian [this message]
2009-03-30 6:50 ` [PATCH 1/2] send-email: refactor and ensure prompting doesn't loop forever Junio C Hamano
2009-03-30 11:29 ` Matthieu Moy
2009-03-30 14:17 ` Jay Soffian
2009-03-30 14:18 ` Jay Soffian
2009-03-30 14:40 ` Matthieu Moy
2009-03-30 15:45 ` Jay Soffian
2009-03-30 16:04 ` Jay Soffian
2009-03-31 9:32 ` Matthieu Moy
2009-03-31 14:12 ` Jay Soffian
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=76718490903281848l5102afc3x89eed40ed6083dcc@mail.gmail.com \
--to=jaysoffian@gmail.com \
--cc=Matthieu.Moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).