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

[PATCH] Check and document the options to prevent mistakes.

From
Eric W. Biederman <ebiederm@xmission.com>
Date
Jun 21, 2006, 13:17 UTC
Message-ID
<m164iu8x78.fsf@ebiederm.dsl.xmission.com>

When multiple recipients are given to git-send-email on the same --cc line the code does not properly handle it.

Full and proper parsing of the email addresses so I can detect which commas mean a new email address is more than I care to implement.

In particular this email address: "bibo,mao" <bibo.mao@intel.com> must not be treated as two email addresses.

So this patch simply treats all commas in recipient lists as an error and fails if one is given.

At the same time it documents that git-send-email wants multiple instances of --cc specified on the command line if you want to cc multiple recipients.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 Documentation/git-send-email.txt |    9 +++++++++
 git-send-email.perl              |   14 ++++++++++++++
 2 files changed, 23 insertions(+)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index ad1b9cf..481b3f5 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -24,9 +24,16 @@ OPTIONS
 -------
 The options available are:
 
+--bcc::
+	Specify a "Bcc:" value for each email.
+
+	The --bcc option must be repeated for each user you want on the bcc list.
+
 --cc::
 	Specify a starting "Cc:" value for each email.
 
+	The --cc option must be repeated for each user you want on the cc list.
+
 --chain-reply-to, --no-chain-reply-to::
 	If this is set, each email will be sent as a reply to the previous
 	email sent.  If disabled with "--no-chain-reply-to", all emails after
@@ -76,6 +83,8 @@ The options available are:
 	Generally, this will be the upstream maintainer of the
 	project involved.
 
+	The --to option must be repeated for each user you want on the to list.
+
 
 Author
 ------
diff --git a/git-send-email.perl b/git-send-email.perl
index 7b1cca7..c5d9e73 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -65,6 +65,20 @@ my $rc = GetOptions("from=s" => \$from,
 		    "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
 	 );
 
+# Verify the user input
+
+foreach my $entry (@to) {
+	die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
+}
+
+foreach my $entry (@initial_cc) {
+	die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/;
+}
+
+foreach my $entry (@bcclist) {
+	die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/;
+}
+
 # Now, let's fill any that aren't set in with defaults:
 
 sub gitvar {
Next: Junio C Hamano
Message 1 of 4 in “Check and document the options to prevent mistakes.”
  1. Check and document the options to prevent mistakes.Eric W. Biederman, Jun 21, 2006
  2. Junio C HamanoJun 21, 2006
  3. Eric W. BiedermanJun 22, 2006
  4. Junio C HamanoJun 22, 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.