git-send-email not sending?
Hi,
I'm using git version 1.5.4.rc3.37.gfdcf3 and when I use git-send-email with the --compose option like this:
git send-email --compose -- a_dir_of_patches/
The intro email gets sent, but not any of the actual patches. If I ommit the --compose option, then the patches do get sent. Pretty sure this worked for me until a recent update so I wonder if there's a buglet in the recent validation patches (or I'm in error and missing some needed config?).
+ seth
Signature · 1 line
Seth Falcon | [email protected] | blog: http://userprimary.net/user/
Test of send-email patch
This email is sent with git send-email --compose to verify that the patch following in the next mail fixes the problem reported by Seth.
/Gustaf
PATCH 1/1 send-email, fix breakage in combination with --compose
This fixes the subtile bug in git send-email that was introduced into git send-email with
commit aa54892f5ada8282643dc7387b33261c7135d784
send-email: detect invocation errors earlier
causing no patches to be sent out if the --compose flag was used.
--- git-send-email.perl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
git-send-email.perl +1 -1
@@ -462,7 +462,7 @@ EOT exit(0); } - @files = ($compose_filename . ".final"); + @files = ($compose_filename . ".final", @files); } # Variables we set as part of the loop over files
Signature · 1 line
1.5.4.rc4.1.gbdcdb
Re: [PATCH] send-email, fix breakage in combination with --compose
Quoted 5 lines · Gustaf Hendeby
This fixes the subtile bug in git send-email that was introduced into git send-email with
commit
aa54892f5ada8282643dc7387b33261c7135d784
send-email: detect invocation errors earlier
Sorry, this was my fault. I have looked over the code again to make sure there are not any other places where the movement of @files should matter, but this seems to be the only one.
As penance, I'll send some tests in a moment.
git-send-email.perl EOT · line 465
Quoted 2 lines
git-send-email.perl +1
-1- @files = ($compose_filename . ".final"); + @files = ($compose_filename . ".final", @files);
I think this might be more readable as
unshift @files, "$compose_filename.final";
but either way it fixes the bug, so
-Peff
PATCH 1/3 t9001: add missing && operators
The exit value of some commands was not being used for the test output.
---
Quoted 1 line · Jeff King
As penance, I'll send some tests in a moment.
This turned into a 3-patch series because of some cleanup needed. This first one is just tightening up the setup tests, which will be modified in the next patch.
t/t9001-send-email.sh | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
t/t9001-send-email.sh +4 -4
@@ -8,7 +8,7 @@ test_expect_success \ 'prepare reference tree' \ 'echo "1A quick brown fox jumps over the" >file && echo "lazy dog" >>file && - git add file + git add file && GIT_AUTHOR_NAME="A" git commit -a -m "Initial."' test_expect_success \
@@ -20,9 +20,9 @@ test_expect_success \ echo " echo \"!\$a!\"" echo "done >commandline" echo "cat > msgtxt" - ) >fake.sendmail - chmod +x ./fake.sendmail - git add fake.sendmail + ) >fake.sendmail && + chmod +x ./fake.sendmail && + git add fake.sendmail && GIT_AUTHOR_NAME="A" git commit -a -m "Second."' test_expect_success 'Extract patches' '
Signature · 1 line
1.5.4.rc3.1130.gd9718-dirty
PATCH 2/3 t9001: enhance fake sendmail test harness
Previously, the fake.sendmail test harness would write its output to a hardcoded file, allowing only a single message to be tested. Instead, let's have it save the messages for all of its invocations so that we can see which messages which were sent, and in which order.
---
This shouldn't change the test behavior at all, but is needed for the test in 3/3.
t/t9001-send-email.sh | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)
t/t9001-send-email.sh +11 -5
@@ -15,16 +15,22 @@ test_expect_success \ 'Setup helper tool' \ '(echo "#!/bin/sh" echo shift + echo output=1 + echo "while test -e commandline\$output; do output=\$((\$output+1)); done" echo for a echo do echo " echo \"!\$a!\"" - echo "done >commandline" - echo "cat > msgtxt" + echo "done >commandline\$output" + echo "cat > msgtxt\$output" ) >fake.sendmail && chmod +x ./fake.sendmail && git add fake.sendmail && GIT_AUTHOR_NAME="A" git commit -a -m "Second."' +clean_fake_sendmail() { + rm -f commandline* msgtxt* +} + test_expect_success 'Extract patches' ' patches=`git format-patch -n HEAD^1` '
@@ -39,7 +45,7 @@ cat >expected <<\EOF EOF test_expect_success \ 'Verify commandline' \ - 'diff commandline expected' + 'diff commandline1 expected' cat >expected-show-all-headers <<\EOF 0001-Second.patch
@@ -82,7 +88,7 @@ z8=zzzzzzzz z64=$z8$z8$z8$z8$z8$z8$z8$z8 z512=$z64$z64$z64$z64$z64$z64$z64$z64 test_expect_success 'reject long lines' ' - rm -f commandline && + clean_fake_sendmail && cp $patches longline.patch && echo $z512$z512 >>longline.patch && ! git send-email \
@@ -95,7 +101,7 @@ test_expect_success 'reject long lines' ' ' test_expect_success 'no patch was sent' ' - ! test -e commandline + ! test -e commandline1 ' test_expect_success 'allow long lines with --no-validate' '
Signature · 1 line
1.5.4.rc3.1130.gd9718-dirty
PATCH 3/3 send-email: test compose functionality
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.
---
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(-)
git-send-email.perl +10 -6
@@ -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";
t/t9001-send-email.sh +27 -0
@@ -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 <[email protected]>" \ + [email protected] \ + --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
Signature · 1 line
1.5.4.rc3.1130.gd9718-dirty
Re: [PATCH] send-email, fix breakage in combination with --compose
In reply to Gustaf HendebyHi Gustaf,
Quoted 9 lines · Gustaf Hendeby
This fixes the subtile bug in git send-email that was introduced into git send-email with
commit
aa54892f5ada8282643dc7387b33261c7135d784
send-email: detect invocation errors earliercausing no patches to be sent out if the --compose flag was used.
Signed-off-by Gustaf Hendeby <[email protected]>
I gave this a quick test and it works for me too. Thanks!
So FWIW,
Signature · 1 line
Seth Falcon | [email protected] | blog: http://userprimary.net/user/