git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/4] Add a basic test case for git send-email, and fix some real bugs discovered.

From
Junio C Hamano <junkio@cox.net>
Date
May 30, 2006, 06:58 UTC
Message-ID
<7vu0782e33.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7v1wuc3t9y.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
> On top of yours, I think this covers the CC: trouble your test
> triggers.

Sorry, I did not look closely enough. You are trying to keep the address human friendly as long as possible so that you can place them on the headers, so the previous one was bogus.

*BLUSH*

I think this is lower impact. On the other hand, it appears that at least whatever pretends to be /usr/lib/sendmail on my box seems to grok 'A <author@example.com>' just fine, so maybe the test was bogus (in which case you should just change the expected command line parameters to include the human name).

I dunno.
-- >8 --
From c95682409346f7acc220ac64f453933d5a59ec3f Mon Sep 17 00:00:00 2001
From: Junio C Hamano <junkio@cox.net>
Date: Mon, 29 May 2006 23:53:13 -0700
Subject: [PATCH] send-email: do not pass bogus address to local sendmail binary
This makes t9001 test happy.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 git-send-email.perl   |    4 +++-
 t/t9001-send-email.sh |   19 +++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index d418d6c..ac84553 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -387,7 +387,9 @@ X-Mailer: git-send-email $gitversion
 		my $pid = open my $sm, '|-';
 		defined $pid or die $!;
 		if (!$pid) {
-			exec($smtp_server,'-i',@recipients) or die $!;
+			exec($smtp_server,'-i',
+			     map { extract_valid_address($_) }
+			     @recipients) or die $!;
 		}
 		print $sm "$header\n$message";
 		close $sm or die $?;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 276cbac..a61da1e 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -13,10 +13,14 @@ test_expect_success \
 
 test_expect_success \
     'Setup helper tool' \
-    'echo "#!/bin/sh" > fake.sendmail
-     echo "shift" >> fake.sendmail
-     echo "echo \"\$*\" > commandline" >> fake.sendmail
-     echo "cat > msgtxt" >> fake.sendmail
+    '(echo "#!/bin/sh"
+      echo shift
+      echo for a
+      echo do
+      echo "  echo \"!\$a!\""
+      echo "done >commandline"
+      echo "cat > msgtxt"
+      ) >fake.sendmail
      chmod +x ./fake.sendmail
      git add fake.sendmail
      GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
@@ -26,9 +30,12 @@ test_expect_success \
     'git format-patch -n HEAD^1
      git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt'
 
+cat >expected <<\EOF
+!nobody@example.com!
+!author@example.com!
+EOF
 test_expect_success \
     'Verify commandline' \
-    'cline=$(cat commandline)
-     [ "$cline" == "nobody@example.com author@example.com" ]'
+    'diff commandline expected'
 
 test_done
-- 
1.3.3.g5029f
Previous: Junio C HamanoNext: Alex Riesen
Message 3 of 10 in “Re: [PATCH 4/4] Add a basic test case for git send-email, and fix some real bugs discovered.”
  1. Junio C HamanoMay 30, 2006
  2. Junio C HamanoMay 30, 2006
  3. Junio C HamanoMay 30, 2006
  4. Alex RiesenMay 30, 2006
  5. Christopher FaylorMay 30, 2006
  6. Alex RiesenMay 30, 2006
  7. Christopher FaylorMay 30, 2006
  8. Ryan AndersonMay 30, 2006
  9. Alex RiesenMay 30, 2006
  10. Ryan AndersonMay 30, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.