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

[PATCH] send-email: add a few config variables.

From
Junio C Hamano <junkio@cox.net>
Date
Apr 30, 2007, 21:00 UTC
Message-ID
<7vzm4pbmsp.fsf_-_@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0704301333400.29859@racer.site>

This adds from, to, suppressfrom and nosignedoffcc configuration variables to git-send-email, so that these common options do not have to be given from the command line all the time.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * I do not use send-email myself that often, but it irritated
   me enough that there do not seem to be a way to set these
   common things in the configuration.  Maybe I was missing
   something obvious and this patch is not needed.  I dunno.
 Documentation/git-send-email.txt |   17 +++++++++++++++++
 git-send-email.perl              |   30 +++++++++++++++++++++++++-----
 2 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 795db87..3435b8c 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -119,6 +119,23 @@ sendemail.chainreplyto::
 	Boolean value specifying the default to the '--chain_reply_to'
 	parameter.
 
+sendemail.fromme::
+	Boolean; when set, use your authorname and authoremail
+	(typically found in `.git/config` as user.name and
+	user.email variables) if `--from` option is not given.
+
+sendemail.to::
+	When `--to` is not specified on the command line, use
+	this address instead.
+
+sendemail.suppressfrom::
+	Boolean; when set, act as if `--suppress-from` is given
+	on the command line.
+
+sendemail.nosignedoffcc::
+	Boolean; when set, act as if `--no-signed-off-cc` is
+	given on the command line.
+
 sendemail.smtpserver::
 	Default smtp server to use.
 
diff --git a/git-send-email.perl b/git-send-email.perl
index a6e3e02..785fb75 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -164,6 +164,18 @@ if (!@bcclist or !$bcclist[0]) {
     @bcclist = ();
 }
 
+my $fromme;
+
+for my $ent (['fromme', \$fromme],
+	     ['suppressfrom', \$suppress_from],
+	     ['nosignedoffcc', \$no_signed_off_cc]) {
+	my $val = $repo->config_boolean('sendemail.' . $ent->[0]);
+	my $var = $ent->[1];
+	${$var} = (! ($val && $val eq 'false'));
+}
+
+my $default_to = $repo->config('sendmail.to');
+
 # Begin by accumulating all the variables (defined above), that we will end up
 # needing, first, from the command line:
 
@@ -187,6 +199,19 @@ unless ($rc) {
     usage();
 }
 
+# Now, let's fill any that aren't set in with defaults:
+
+my ($author) = $repo->ident_person('author');
+my ($committer) = $repo->ident_person('committer');
+
+if ($fromme && !defined $from) {
+	$from = $author;
+}
+
+if (!@to && $default_to ne '') {
+	push @to, $default_to;
+}
+
 # Verify the user input
 
 foreach my $entry (@to) {
@@ -201,11 +226,6 @@ 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:
-
-my ($author) = $repo->ident_person('author');
-my ($committer) = $repo->ident_person('committer');
-
 my %aliases;
 my @alias_files = $repo->config('sendemail.aliasesfile');
 my $aliasfiletype = $repo->config('sendemail.aliasfiletype');
-- 
1.5.2.rc0.781.g5868
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 9 in “Checklist clarifications: added "Commits", "Patch:" headings”
  1. Checklist clarifications: added "Commits", "Patch:" headingsJari Aalto, Apr 30, 2007
  2. Johannes SchindelinApr 30, 2007
  3. Jari AaltoApr 30, 2007
  4. Julian PhillipsApr 30, 2007
  5. Johannes SchindelinApr 30, 2007
  6. Jari AaltoApr 30, 2007
  7. Junio C HamanoApr 30, 2007
  8. send-email: add a few config variables.Junio C Hamano, Apr 30, 2007
  9. Junio C HamanoMay 1, 2007

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.