From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Gustaf Hendeby <hendeby@isy.liu.se>,
Seth Falcon <seth@userprimary.net>,
git@vger.kernel.org
Subject: [PATCH 3/3] send-email: test compose functionality
Date: Mon, 21 Jan 2008 22:29:05 -0500 [thread overview]
Message-ID: <20080122032905.GD24758@coredump.intra.peff.net> (raw)
In-Reply-To: <20080122032544.GC24758@coredump.intra.peff.net>
This is just a basic sanity check that --compose works at
all. Unfortunately, we have to add a --no-confirm-send
option to git-send-email to make this work, since it
otherwise unconditionally tries to talk to the terminal.
Signed-off-by: Jeff King <peff@peff.net>
---
Note that the change to git-send-email depends textually on Gustaf's
fix (actually, on my suggested version). I am not happy with adding the
--no-confirm-send option, but there just isn't any way to avoid the
readline call with the existing code short of providing a dummy perl
module in the test harness.
git-send-email.perl | 16 ++++++++++------
t/t9001-send-email.sh | 27 +++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index df1c833..f265a82 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -180,6 +180,7 @@ my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_authpass, $smtp_ssl);
my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
my ($no_validate);
+my ($no_confirm_send);
my %config_bool_settings = (
"thread" => [\$thread, 1],
@@ -226,6 +227,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
"envelope-sender=s" => \$envelope_sender,
"thread!" => \$thread,
"no-validate" => \$no_validate,
+ "no-confirm-send" => \$no_confirm_send,
);
unless ($rc) {
@@ -453,13 +455,15 @@ EOT
close(C);
close(C2);
- do {
- $_ = $term->readline("Send this email? (y|n) ");
- } while (!defined $_);
+ if (!$no_confirm_send) {
+ do {
+ $_ = $term->readline("Send this email? (y|n) ");
+ } while (!defined $_);
- if (uc substr($_,0,1) ne 'Y') {
- cleanup_compose_files();
- exit(0);
+ if (uc substr($_,0,1) ne 'Y') {
+ cleanup_compose_files();
+ exit(0);
+ }
}
unshift @files, "$compose_filename.final";
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index dd0c395..b1e9de5 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -114,4 +114,31 @@ test_expect_success 'allow long lines with --no-validate' '
2>errors
'
+test_expect_success 'setup fake editor' '
+ (echo "#!/bin/sh" &&
+ echo "echo fake edit >>\$1"
+ ) >fake-editor &&
+ chmod +x fake-editor
+'
+
+test_expect_success '--compose works' '
+ clean_fake_sendmail &&
+ GIT_EDITOR=$(pwd)/fake-editor \
+ git send-email \
+ --compose --subject foo --no-confirm-send \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches \
+ 2>errors
+'
+
+test_expect_success 'first message is compose text' '
+ grep "^fake edit" msgtxt1
+'
+
+test_expect_success 'second message is patch' '
+ grep "Subject:.*Second" msgtxt2
+'
+
test_done
--
1.5.4.rc3.1130.gd9718-dirty
prev parent reply other threads:[~2008-01-22 3:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-21 18:30 git-send-email not sending? Seth Falcon
2008-01-21 19:57 ` Test of send-email patch Gustaf Hendeby
2008-01-21 19:57 ` [PATCH] send-email, fix breakage in combination with --compose Gustaf Hendeby
2008-01-22 0:05 ` Seth Falcon
2008-01-22 3:19 ` Jeff King
2008-01-22 3:23 ` [PATCH 1/3] t9001: add missing && operators Jeff King
2008-01-22 3:25 ` [PATCH 2/3] t9001: enhance fake sendmail test harness Jeff King
2008-01-22 3:29 ` Jeff King [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=20080122032905.GD24758@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hendeby@isy.liu.se \
--cc=seth@userprimary.net \
/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).