git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-send-email not sending?
@ 2008-01-21 18:30 Seth Falcon
  2008-01-21 19:57 ` Test of send-email patch Gustaf Hendeby
  0 siblings, 1 reply; 8+ messages in thread
From: Seth Falcon @ 2008-01-21 18:30 UTC (permalink / raw)
  To: git

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

-- 
Seth Falcon | seth@userprimary.net | blog: http://userprimary.net/user/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Test of send-email patch
  2008-01-21 18:30 git-send-email not sending? Seth Falcon
@ 2008-01-21 19:57 ` Gustaf Hendeby
  2008-01-21 19:57   ` [PATCH] send-email, fix breakage in combination with --compose Gustaf Hendeby
  0 siblings, 1 reply; 8+ messages in thread
From: Gustaf Hendeby @ 2008-01-21 19:57 UTC (permalink / raw)
  To: Seth Falcon, gitster; +Cc: git

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] send-email, fix breakage in combination with --compose
  2008-01-21 19:57 ` Test of send-email patch Gustaf Hendeby
@ 2008-01-21 19:57   ` Gustaf Hendeby
  2008-01-22  0:05     ` Seth Falcon
  2008-01-22  3:19     ` Jeff King
  0 siblings, 2 replies; 8+ messages in thread
From: Gustaf Hendeby @ 2008-01-21 19:57 UTC (permalink / raw)
  To: Seth Falcon, gitster; +Cc: git, 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

causing no patches to be sent out if the --compose flag was used.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
---
 git-send-email.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 6c72952..a1a9d14 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -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
-- 
1.5.4.rc4.1.gbdcdb

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] send-email, fix breakage in combination with --compose
  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
  1 sibling, 0 replies; 8+ messages in thread
From: Seth Falcon @ 2008-01-22  0:05 UTC (permalink / raw)
  To: Gustaf Hendeby; +Cc: gitster, git

Hi Gustaf,

Gustaf Hendeby <hendeby@isy.liu.se> writes:
> 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.
>
> Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>

I gave this a quick test and it works for me too.  Thanks!

So FWIW,

Acked-by: Seth Falcon <seth@userprimary.net>

-- 
Seth Falcon | seth@userprimary.net | blog: http://userprimary.net/user/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] send-email, fix breakage in combination with --compose
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Jeff King @ 2008-01-22  3:19 UTC (permalink / raw)
  To: Gustaf Hendeby; +Cc: Seth Falcon, gitster, git

On Mon, Jan 21, 2008 at 08:57:46PM +0100, Gustaf Hendeby wrote:

> 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.

> -	@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

Acked-by: Jeff King <peff@peff.net>

-Peff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] t9001: add missing && operators
  2008-01-22  3:19     ` Jeff King
@ 2008-01-22  3:23       ` Jeff King
  2008-01-22  3:25         ` [PATCH 2/3] t9001: enhance fake sendmail test harness Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff King @ 2008-01-22  3:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Gustaf Hendeby, Seth Falcon, git


The exit value of some commands was not being used for the
test output.

Signed-off-by: Jeff King <peff@peff.net>
---
On Mon, Jan 21, 2008 at 10:19:32PM -0500, Jeff King wrote:

> 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(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 4f6822f..08f7c3d 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -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' '
-- 
1.5.4.rc3.1130.gd9718-dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] t9001: enhance fake sendmail test harness
  2008-01-22  3:23       ` [PATCH 1/3] t9001: add missing && operators Jeff King
@ 2008-01-22  3:25         ` Jeff King
  2008-01-22  3:29           ` [PATCH 3/3] send-email: test compose functionality Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff King @ 2008-01-22  3:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Gustaf Hendeby, Seth Falcon, git

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.

Signed-off-by: Jeff King <peff@peff.net>
---
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(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 08f7c3d..dd0c395 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -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' '
-- 
1.5.4.rc3.1130.gd9718-dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] send-email: test compose functionality
  2008-01-22  3:25         ` [PATCH 2/3] t9001: enhance fake sendmail test harness Jeff King
@ 2008-01-22  3:29           ` Jeff King
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff King @ 2008-01-22  3:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Gustaf Hendeby, Seth Falcon, git

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-01-22  3:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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           ` [PATCH 3/3] send-email: test compose functionality Jeff King

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).