git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 2/2] send-email: add series-cc-cmd option
  @ 2012-11-11 17:04 51% ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2012-11-11 17:04 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Joe Perches, Jonathan Nieder, Pascal Obry,
	Felipe Contreras

cc-cmd is only per-file, and many times receipients get lost without
seing the full patch series.

So, add an option for series-cc-cmd, which receives as an argument
rev-list options, just like format-patch.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-send-email.txt       | 7 +++++++
 contrib/completion/git-completion.bash | 2 +-
 git-send-email.perl                    | 9 ++++++++-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3241170..1161d3e 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -218,6 +218,13 @@ Automating
 	Output of this command must be single email address per line.
 	Default is the value of 'sendemail.cccmd' configuration value.
 
+--series-cc-cmd=<command>::
+	Specify a command to execute to generate "Cc:" entries for the whole
+	patch series.
+	The arguments would be the same rev-list options the user specified.
+	Output of this command must be single email address per line.
+	Default is the value of 'sendemail.seriescccmd' configuration value.
+
 --[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
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index be800e0..0b04229 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1555,7 +1555,7 @@ _git_send_email ()
 		return
 		;;
 	--*)
-		__gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
+		__gitcomp "--annotate --bcc --cc --cc-cmd --series-cc-cmd --chain-reply-to
 			--compose --confirm= --dry-run --envelope-sender
 			--from --identity
 			--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
diff --git a/git-send-email.perl b/git-send-email.perl
index 26d4477..da89ac6 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -191,7 +191,7 @@ sub do_edit {
 
 # Variables with corresponding config settings
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);
-my ($to_cmd, $cc_cmd);
+my ($to_cmd, $cc_cmd, $series_cc_cmd);
 my ($smtp_server, $smtp_server_port, @smtp_server_options);
 my ($smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
@@ -224,6 +224,7 @@ my %config_settings = (
     "tocmd" => \$to_cmd,
     "cc" => \@initial_cc,
     "cccmd" => \$cc_cmd,
+    "seriescccmd" => \$series_cc_cmd,
     "aliasfiletype" => \$aliasfiletype,
     "bcc" => \@bcclist,
     "suppresscc" => \@suppress_cc,
@@ -305,6 +306,7 @@ my $rc = GetOptions("h" => \$help,
 		    "compose" => \$compose,
 		    "quiet" => \$quiet,
 		    "cc-cmd=s" => \$cc_cmd,
+		    "series-cc-cmd=s" => \$series_cc_cmd,
 		    "suppress-from!" => \$suppress_from,
 		    "suppress-cc=s" => \@suppress_cc,
 		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
@@ -766,6 +768,11 @@ if (!@initial_to && !defined $to_cmd) {
 	$prompting++;
 }
 
+if (@rev_list_opts) {
+	push @initial_cc, recipients_cmd("series-cc-cmd", "cc", $series_cc_cmd, @rev_list_opts)
+		if defined $series_cc_cmd;
+}
+
 sub expand_aliases {
 	return map { expand_one_alias($_) } @_;
 }
-- 
1.8.0

^ permalink raw reply related	[relevance 51%]

* [PATCH 6/9] add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"
  @ 2009-11-12  0:02 51%               ` Jonathan Nieder
  0 siblings, 0 replies; 200+ results
From: Jonathan Nieder @ 2009-11-12  0:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ben Walton, Johannes Sixt, David Roundy, GIT List

Use the new "git var GIT_EDITOR" feature to decide what editor to
use, instead of duplicating its logic elsewhere.  This should make
the behavior of commands in edge cases (e.g., editor names with
spaces) a little more consistent.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Unchanged from pu.

 Documentation/config.txt         |    4 +---
 Documentation/git-commit.txt     |    2 +-
 Documentation/git-send-email.txt |    4 ++--
 contrib/fast-import/git-p4       |    5 +----
 git-add--interactive.perl        |    3 +--
 git-send-email.perl              |    3 ++-
 git-sh-setup.sh                  |   19 ++++++-------------
 git-svn.perl                     |    5 ++---
 8 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index d1e2120..5181b77 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -387,9 +387,7 @@ core.editor::
 	Commands such as `commit` and `tag` that lets you edit
 	messages by launching an editor uses the value of this
 	variable when it is set, and the environment variable
-	`GIT_EDITOR` is not set.  The order of preference is
-	`GIT_EDITOR` environment, `core.editor`, `VISUAL` and
-	`EDITOR` environment variables and then finally `vi`.
+	`GIT_EDITOR` is not set.  See linkgit:git-var[1].
 
 core.pager::
 	The command that git will use to paginate output.  Can
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 0578a40..3ea80c8 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -323,7 +323,7 @@ ENVIRONMENT AND CONFIGURATION VARIABLES
 The editor used to edit the commit log message will be chosen from the
 GIT_EDITOR environment variable, the core.editor configuration variable, the
 VISUAL environment variable, or the EDITOR environment variable (in that
-order).
+order).  See linkgit:git-var[1] for details.
 
 HOOKS
 -----
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 767cf4d..c85d7f4 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -60,8 +60,8 @@ The --bcc option must be repeated for each user you want on the bcc list.
 The --cc option must be repeated for each user you want on the cc list.
 
 --compose::
-	Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an
-	introductory message for the patch series.
+	Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1])
+	to edit an introductory message for the patch series.
 +
 When '--compose' is used, git send-email will use the From, Subject, and
 In-Reply-To headers specified in the message. If the body of the message
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index e710219..48059d0 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -729,13 +729,10 @@ class P4Submit(Command):
             tmpFile.write(submitTemplate + separatorLine + diff + newdiff)
             tmpFile.close()
             mtime = os.stat(fileName).st_mtime
-            defaultEditor = "vi"
-            if platform.system() == "Windows":
-                defaultEditor = "notepad"
             if os.environ.has_key("P4EDITOR"):
                 editor = os.environ.get("P4EDITOR")
             else:
-                editor = os.environ.get("EDITOR", defaultEditor);
+                editor = read_pipe("git var GIT_EDITOR")
             system(editor + " " + fileName)
 
             response = "y"
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 69aeaf0..0c74e5c 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -987,8 +987,7 @@ sub edit_hunk_manually {
 EOF
 	close $fh;
 
-	my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor")
-		|| $ENV{VISUAL} || $ENV{EDITOR} || "vi";
+	chomp(my $editor = run_cmd_pipe(qw(git var GIT_EDITOR)));
 	system('sh', '-c', $editor.' "$@"', $editor, $hunkfile);
 
 	if ($? != 0) {
diff --git a/git-send-email.perl b/git-send-email.perl
index a0279de..4f5da4e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -162,7 +162,8 @@ my $compose_filename;
 
 # Handle interactive edition of files.
 my $multiedit;
-my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
+my $editor = Git::command_oneline('var', 'GIT_EDITOR');
+
 sub do_edit {
 	if (defined($multiedit) && !$multiedit) {
 		map {
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index c41c2f7..99cceeb 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -99,19 +99,12 @@ set_reflog_action() {
 }
 
 git_editor() {
-	: "${GIT_EDITOR:=$(git config core.editor)}"
-	: "${GIT_EDITOR:=${VISUAL:-${EDITOR}}}"
-	case "$GIT_EDITOR,$TERM" in
-	,dumb)
-		echo >&2 "No editor specified in GIT_EDITOR, core.editor, VISUAL,"
-		echo >&2 "or EDITOR. Tried to fall back to vi but terminal is dumb."
-		echo >&2 "Please set one of these variables to an appropriate"
-		echo >&2 "editor or run $0 with options that will not cause an"
-		echo >&2 "editor to be invoked (e.g., -m or -F for git-commit)."
-		exit 1
-		;;
-	esac
-	eval "${GIT_EDITOR:=vi}" '"$@"'
+	if test -z "${GIT_EDITOR:+set}"
+	then
+		GIT_EDITOR="$(git var GIT_EDITOR)" || return $?
+	fi
+
+	eval "$GIT_EDITOR" '"$@"'
 }
 
 is_bare_repository () {
diff --git a/git-svn.perl b/git-svn.perl
index 6a3b501..42c9a72 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1321,9 +1321,8 @@ sub get_commit_entry {
 	close $log_fh or croak $!;
 
 	if ($_edit || ($type eq 'tree')) {
-		my $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi';
-		# TODO: strip out spaces, comments, like git-commit.sh
-		system($editor, $commit_editmsg);
+		chomp(my $editor = command_oneline(qw(var GIT_EDITOR)));
+		system('sh', '-c', $editor.' "$@"', $editor, $commit_editmsg);
 	}
 	rename $commit_editmsg, $commit_msg or croak $!;
 	{
-- 
1.6.5.2

^ permalink raw reply related	[relevance 51%]

* [PATCH] send-email: Add config option for sender address
@ 2009-02-19  1:00 51% Trent Piepho
  0 siblings, 0 replies; 200+ results
From: Trent Piepho @ 2009-02-19  1:00 UTC (permalink / raw)
  To: git; +Cc: Trent Piepho, gitster

The sender address, as specified with the '--from' command line option,
couldn't be set in the config file.  So add a new config option,
'sendemail.from', which sets it.  One can use 'sendemail.<identity>.from'
as well of course, which is likely the more useful case.

The sender address would default to GIT_AUTHOR_IDENT, which is usually the
right thing, but this doesn't allow switching based on the identity
selected.  It's possible to switch the SMTP server and envelope sender by
using the '--identity' option, in which case one probably wants to use a
different from address as well, but this had to be manually specified.

The docs are also fixed up somewhat.  If '--from' is specified (or the new
sendemail.from option is used) then the user isn't prompted.  The default
with no '--from' option (or sendemail.from option) is GIT_AUTHOR_IDENT
first then GIT_COMMITTER_IDENT, not just GIT_COMMITTER_IDENT.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
---
 Documentation/git-send-email.txt |    9 ++++++---
 git-send-email.perl              |    1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index ff4aeff..8345df2 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -57,9 +57,12 @@ If it wasn't able to see a header in the summary it will ask you about it
 interactively after quitting your editor.
 
 --from::
-	Specify the sender of the emails.  This will default to
-	the value GIT_COMMITTER_IDENT, as returned by "git var -l".
-	The user will still be prompted to confirm this entry.
+	Specify the sender of the emails.  If not specified on the command line,
+	the value of the 'sendemail.from' configuration option is used.  If
+	neither the command line option nor 'sendemail.from' are set, then the
+	user will be prompted for the value.  The default for the prompt will be
+	the value of GIT_AUTHOR_IDENT, or GIT_COMMITTER_IDENT if that is not
+	set, as returned by "git var -l".
 
 --in-reply-to::
 	Specify the contents of the first In-Reply-To header.
diff --git a/git-send-email.perl b/git-send-email.perl
index 77ca8fe..ec58f12 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -207,6 +207,7 @@ my %config_settings = (
     "suppresscc" => \@suppress_cc,
     "envelopesender" => \$envelope_sender,
     "multiedit" => \$multiedit,
+    "from" => \$sender,
 );
 
 # Handle Uncouth Termination
-- 
1.5.4.1

^ permalink raw reply related	[relevance 51%]

* [PATCH v8 35/37] git-send-email: use 'git hook run' for 'sendemail-validate'
  @ 2021-03-11  2:10 51% ` Emily Shaffer
  0 siblings, 0 replies; 200+ results
From: Emily Shaffer @ 2021-03-11  2:10 UTC (permalink / raw)
  To: git; +Cc: Emily Shaffer

By using the new 'git hook run' subcommand to run 'sendemail-validate',
we can reduce the boilerplate needed to run this hook in perl. Using
config-based hooks also allows us to run 'sendemail-validate' hooks that
were configured globally when running 'git send-email' from outside of a
Git directory, alongside other benefits like multihooks and
parallelization.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
---
 git-send-email.perl   | 21 ++++-----------------
 t/t9001-send-email.sh | 11 +----------
 2 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 1f425c0809..73e1e0b51a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1941,23 +1941,10 @@ sub unique_email_list {
 sub validate_patch {
 	my ($fn, $xfer_encoding) = @_;
 
-	if ($repo) {
-		my $validate_hook = catfile(catdir($repo->repo_path(), 'hooks'),
-					    'sendemail-validate');
-		my $hook_error;
-		if (-x $validate_hook) {
-			my $target = abs_path($fn);
-			# The hook needs a correct cwd and GIT_DIR.
-			my $cwd_save = cwd();
-			chdir($repo->wc_path() or $repo->repo_path())
-				or die("chdir: $!");
-			local $ENV{"GIT_DIR"} = $repo->repo_path();
-			$hook_error = "rejected by sendemail-validate hook"
-				if system($validate_hook, $target);
-			chdir($cwd_save) or die("chdir: $!");
-		}
-		return $hook_error if $hook_error;
-	}
+	my $target = abs_path($fn);
+	return "rejected by sendemail-validate hook"
+		if system(("git", "hook", "run", "sendemail-validate", "-a",
+				$target));
 
 	# Any long lines will be automatically fixed if we use a suitable transfer
 	# encoding.
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 4eee9c3dcb..456b471c5c 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -2101,16 +2101,7 @@ test_expect_success $PREREQ 'invoke hook' '
 	mkdir -p .git/hooks &&
 
 	write_script .git/hooks/sendemail-validate <<-\EOF &&
-	# test that we have the correct environment variable, pwd, and
-	# argument
-	case "$GIT_DIR" in
-	*.git)
-		true
-		;;
-	*)
-		false
-		;;
-	esac &&
+	# test that we have the correct argument
 	test -f 0001-add-main.patch &&
 	grep "add main" "$1"
 	EOF
-- 
2.31.0.rc2.261.g7f71774620-goog


^ permalink raw reply related	[relevance 51%]

* [PATCH 5/6] send-email: fix non-threaded mails
    2009-06-07 21:40 53% ` [PATCH 3/6] send-email: fix threaded mails without chain-reply-to Markus Heidelberg
@ 2009-06-07 21:40 51% ` Markus Heidelberg
  1 sibling, 0 replies; 200+ results
From: Markus Heidelberg @ 2009-06-07 21:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Markus Heidelberg, Thomas Rast, Michael Witten

After commit 3e0c4ff (send-email: respect in-reply-to regardless of
threading, 2009-03-01) the variable $thread was only used for prompting
for an "In-Reply-To", but not for controlling whether the "In-Reply-To"
and "References" fields should be written into the email.

Thus these fields were always used beginning with the second mail and it
was not possible to produce non-threaded mails anymore until commit
15da108 ("send-email: 'References:' should only reference what is sent",
2009-04-13), which introduced a regression with the side effect to make
it possible again when --no-chain-reply-to was set.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 git-send-email.perl   |    5 ++++-
 t/t9001-send-email.sh |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index c11a245..be63ea7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1142,7 +1142,10 @@ foreach my $t (@files) {
 	my $message_was_sent = send_message();
 
 	# set up for the next message
-	if ($message_was_sent and $chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
+	if ($message_was_sent and $thread and
+			$chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
+		# with --chain-reply-to every time
+		# else only after the first mail (and only if --in-reply-to was not specified)
 		$reply_to = $message_id;
 		if (length $references > 0) {
 			$references .= "\n $message_id";
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 9cddd5f..12433a7 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -621,7 +621,7 @@ test_expect_success 'in-reply-to but no threading' '
 	grep "In-Reply-To: <in-reply-id@example.com>"
 '
 
-test_expect_failure 'no in-reply-to and no threading' '
+test_expect_success 'no in-reply-to and no threading' '
 	! git send-email \
 		--dry-run \
 		--from="Example <nobody@example.com>" \
-- 
1.6.3.2.221.g0ff2f

^ permalink raw reply related	[relevance 51%]

* [PATCH] send-email: Add tocmd option to suppress-cc
@ 2017-05-18 11:35 51% Viresh Kumar
  0 siblings, 0 replies; 200+ results
From: Viresh Kumar @ 2017-05-18 11:35 UTC (permalink / raw)
  To: git; +Cc: gitster, avarab, Vincent Guittot, Viresh Kumar

This adds tocmd option to suppress-cc command which already supports
cccmd and others.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 Documentation/git-send-email.txt | 1 +
 git-send-email.perl              | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 9d66166f69d9..f1634f7db3df 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -307,6 +307,7 @@ Automating
   patch body (commit message) except for self (use 'self' for that).
 - 'sob' will avoid including anyone mentioned in Signed-off-by lines except
    for self (use 'self' for that).
+- 'tocmd' will avoid running the --to-cmd.
 - 'cccmd' will avoid running the --cc-cmd.
 - 'body' is equivalent to 'sob' + 'bodycc'
 - 'all' will suppress all auto cc values.
diff --git a/git-send-email.perl b/git-send-email.perl
index eea0a517f71b..cc3cd984aee4 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -85,7 +85,7 @@ git send-email --dump-aliases
     --identity              <str>  * Use the sendemail.<id> options.
     --to-cmd                <str>  * Email To: via `<str> \$patch_path`
     --cc-cmd                <str>  * Email Cc: via `<str> \$patch_path`
-    --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, bodycc, all.
+    --suppress-cc           <str>  * author, self, sob, cc, tocmd, cccmd, body, bodycc, all.
     --[no-]cc-cover                * Email Cc: addresses in the cover letter.
     --[no-]to-cover                * Email To: addresses in the cover letter.
     --[no-]signed-off-by-cc        * Send to Signed-off-by: addresses. Default on.
@@ -435,13 +435,13 @@ my(%suppress_cc);
 if (@suppress_cc) {
 	foreach my $entry (@suppress_cc) {
 		die sprintf(__("Unknown --suppress-cc field: '%s'\n"), $entry)
-			unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc)$/;
+			unless $entry =~ /^(?:all|tocmd|cccmd|cc|author|self|sob|body|bodycc)$/;
 		$suppress_cc{$entry} = 1;
 	}
 }
 
 if ($suppress_cc{'all'}) {
-	foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
+	foreach my $entry (qw (tocmd cccmd cc author self sob body bodycc)) {
 		$suppress_cc{$entry} = 1;
 	}
 	delete $suppress_cc{'all'};
@@ -1582,7 +1582,7 @@ foreach my $t (@files) {
 	close $fh;
 
 	push @to, recipients_cmd("to-cmd", "to", $to_cmd, $t)
-		if defined $to_cmd;
+		if defined $to_cmd && !$suppress_cc{'tocmd'};
 	push @cc, recipients_cmd("cc-cmd", "cc", $cc_cmd, $t)
 		if defined $cc_cmd && !$suppress_cc{'cccmd'};
 
-- 
2.13.0.70.g6367777092d9


^ permalink raw reply related	[relevance 51%]

* [PATCH 2/6] send-email: fix non-threaded mails
    2009-06-12 10:51 52% ` [PATCH 5/6] send-email: fix threaded mails without chain-reply-to Markus Heidelberg
@ 2009-06-12 10:51 51% ` Markus Heidelberg
  1 sibling, 0 replies; 200+ results
From: Markus Heidelberg @ 2009-06-12 10:51 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Michael Witten, Thomas Rast, Markus Heidelberg,
	Junio C Hamano

After commit 3e0c4ff (send-email: respect in-reply-to regardless of
threading, 2009-03-01) the variable $thread was only used for prompting
for an "In-Reply-To", but not for controlling whether the "In-Reply-To"
and "References" fields should be written into the email.

Thus these fields were always used beginning with the second mail and it
was not possible to produce non-threaded mails anymore.

However, a later commit 15da108 ("send-email: 'References:' should only
reference what is sent", 2009-04-13) introduced a regression with the
side effect to make non-threaded mails possible again, but only when
--no-chain-reply-to was used.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * Applies on top of [1/6]

 git-send-email.perl   |    3 ++-
 t/t9001-send-email.sh |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index cccbf45..5d51697 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1137,7 +1137,8 @@ foreach my $t (@files) {
 	send_message();
 
 	# set up for the next message
-	if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
+	if ($thread &&
+		($chain_reply_to || !defined $reply_to || length($reply_to) == 0)) {
 		$reply_to = $message_id;
 		if (length $references > 0) {
 			$references .= "\n $message_id";
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 5bfa36e..8518aca 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -621,7 +621,7 @@ test_expect_success 'in-reply-to but no threading' '
 	grep "In-Reply-To: <in-reply-id@example.com>"
 '
 
-test_expect_failure 'no in-reply-to and no threading' '
+test_expect_success 'no in-reply-to and no threading' '
 	git send-email \
 		--dry-run \
 		--from="Example <nobody@example.com>" \
-- 
1.6.3.2.236.ge505d

^ permalink raw reply related	[relevance 51%]

* [PATCH 3/3] send-email: add no-validate option
  @ 2008-01-18 14:20 51% ` Jeff King
  0 siblings, 0 replies; 200+ results
From: Jeff King @ 2008-01-18 14:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Sixt, Adam Piatyszek, git

Since we are now sanity-checking the contents of patches and
refusing to send ones with long lines, this knob provides a
way for the user to override the new behavior (if, e.g., he
knows his SMTP path will handle it).

Signed-off-by: Jeff King <peff@peff.net>
---
 git-send-email.perl   |   12 +++++++++---
 t/t9001-send-email.sh |   10 ++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 144d7d4..39e0222 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -100,6 +100,8 @@ Options:
 
    --envelope-sender	Specify the envelope sender used to send the emails.
 
+   --no-validate	Don't perform any sanity checks on patches.
+
 EOT
 	exit(1);
 }
@@ -177,6 +179,7 @@ my ($quiet, $dry_run) = (0, 0);
 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 %config_bool_settings = (
     "thread" => [\$thread, 1],
@@ -222,6 +225,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
+		    "no-validate" => \$no_validate,
 	 );
 
 unless ($rc) {
@@ -332,9 +336,11 @@ for my $f (@ARGV) {
 	}
 }
 
-foreach my $f (@files) {
-	my $error = validate_patch($f);
-	$error and die "fatal: $f: $error\nwarning: no patches were sent\n";
+if (!$no_validate) {
+	foreach my $f (@files) {
+		my $error = validate_patch($f);
+		$error and die "fatal: $f: $error\nwarning: no patches were sent\n";
+	}
 }
 
 if (@files) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1c41810..4f6822f 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -98,4 +98,14 @@ test_expect_success 'no patch was sent' '
 	! test -e commandline
 '
 
+test_expect_success 'allow long lines with --no-validate' '
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		--no-validate \
+		$patches longline.patch \
+		2>errors
+'
+
 test_done
-- 
1.5.4.rc3.1128.g1826-dirty

^ permalink raw reply related	[relevance 51%]

* [PATCH 5/8] add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"
  @ 2009-10-30 10:32 51%           ` Jonathan Nieder
    1 sibling, 0 replies; 200+ results
From: Jonathan Nieder @ 2009-10-30 10:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ben Walton, Johannes Sixt, David Roundy, GIT List

Use the new "git var GIT_EDITOR" feature to decide what editor to
use, instead of duplicating its logic elsewhere.  This should make
the behavior of commands in edge cases (e.g., editor names with
spaces) a little more consistent.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Documentation/config.txt         |    4 +---
 Documentation/git-commit.txt     |    2 +-
 Documentation/git-send-email.txt |    4 ++--
 contrib/fast-import/git-p4       |    5 +----
 git-add--interactive.perl        |    3 +--
 git-send-email.perl              |    3 ++-
 git-sh-setup.sh                  |   19 ++++++-------------
 git-svn.perl                     |    5 ++---
 8 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index d1e2120..5181b77 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -387,9 +387,7 @@ core.editor::
 	Commands such as `commit` and `tag` that lets you edit
 	messages by launching an editor uses the value of this
 	variable when it is set, and the environment variable
-	`GIT_EDITOR` is not set.  The order of preference is
-	`GIT_EDITOR` environment, `core.editor`, `VISUAL` and
-	`EDITOR` environment variables and then finally `vi`.
+	`GIT_EDITOR` is not set.  See linkgit:git-var[1].
 
 core.pager::
 	The command that git will use to paginate output.  Can
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 0578a40..3ea80c8 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -323,7 +323,7 @@ ENVIRONMENT AND CONFIGURATION VARIABLES
 The editor used to edit the commit log message will be chosen from the
 GIT_EDITOR environment variable, the core.editor configuration variable, the
 VISUAL environment variable, or the EDITOR environment variable (in that
-order).
+order).  See linkgit:git-var[1] for details.
 
 HOOKS
 -----
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 767cf4d..c85d7f4 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -60,8 +60,8 @@ The --bcc option must be repeated for each user you want on the bcc list.
 The --cc option must be repeated for each user you want on the cc list.
 
 --compose::
-	Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an
-	introductory message for the patch series.
+	Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1])
+	to edit an introductory message for the patch series.
 +
 When '--compose' is used, git send-email will use the From, Subject, and
 In-Reply-To headers specified in the message. If the body of the message
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index e710219..48059d0 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -729,13 +729,10 @@ class P4Submit(Command):
             tmpFile.write(submitTemplate + separatorLine + diff + newdiff)
             tmpFile.close()
             mtime = os.stat(fileName).st_mtime
-            defaultEditor = "vi"
-            if platform.system() == "Windows":
-                defaultEditor = "notepad"
             if os.environ.has_key("P4EDITOR"):
                 editor = os.environ.get("P4EDITOR")
             else:
-                editor = os.environ.get("EDITOR", defaultEditor);
+                editor = read_pipe("git var GIT_EDITOR")
             system(editor + " " + fileName)
 
             response = "y"
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 69aeaf0..0c74e5c 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -987,8 +987,7 @@ sub edit_hunk_manually {
 EOF
 	close $fh;
 
-	my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor")
-		|| $ENV{VISUAL} || $ENV{EDITOR} || "vi";
+	chomp(my $editor = run_cmd_pipe(qw(git var GIT_EDITOR)));
 	system('sh', '-c', $editor.' "$@"', $editor, $hunkfile);
 
 	if ($? != 0) {
diff --git a/git-send-email.perl b/git-send-email.perl
index a0279de..4f5da4e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -162,7 +162,8 @@ my $compose_filename;
 
 # Handle interactive edition of files.
 my $multiedit;
-my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
+my $editor = Git::command_oneline('var', 'GIT_EDITOR');
+
 sub do_edit {
 	if (defined($multiedit) && !$multiedit) {
 		map {
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index c41c2f7..99cceeb 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -99,19 +99,12 @@ set_reflog_action() {
 }
 
 git_editor() {
-	: "${GIT_EDITOR:=$(git config core.editor)}"
-	: "${GIT_EDITOR:=${VISUAL:-${EDITOR}}}"
-	case "$GIT_EDITOR,$TERM" in
-	,dumb)
-		echo >&2 "No editor specified in GIT_EDITOR, core.editor, VISUAL,"
-		echo >&2 "or EDITOR. Tried to fall back to vi but terminal is dumb."
-		echo >&2 "Please set one of these variables to an appropriate"
-		echo >&2 "editor or run $0 with options that will not cause an"
-		echo >&2 "editor to be invoked (e.g., -m or -F for git-commit)."
-		exit 1
-		;;
-	esac
-	eval "${GIT_EDITOR:=vi}" '"$@"'
+	if test -z "${GIT_EDITOR:+set}"
+	then
+		GIT_EDITOR="$(git var GIT_EDITOR)" || return $?
+	fi
+
+	eval "$GIT_EDITOR" '"$@"'
 }
 
 is_bare_repository () {
diff --git a/git-svn.perl b/git-svn.perl
index 6a3b501..42c9a72 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1321,9 +1321,8 @@ sub get_commit_entry {
 	close $log_fh or croak $!;
 
 	if ($_edit || ($type eq 'tree')) {
-		my $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi';
-		# TODO: strip out spaces, comments, like git-commit.sh
-		system($editor, $commit_editmsg);
+		chomp(my $editor = command_oneline(qw(var GIT_EDITOR)));
+		system('sh', '-c', $editor.' "$@"', $editor, $commit_editmsg);
 	}
 	rename $commit_editmsg, $commit_msg or croak $!;
 	{
-- 
1.6.5.2

^ permalink raw reply related	[relevance 51%]

* [PATCH 5/8] add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"
  @ 2009-10-31  1:42 51%             ` Jonathan Nieder
    1 sibling, 0 replies; 200+ results
From: Jonathan Nieder @ 2009-10-31  1:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ben Walton, Johannes Sixt, David Roundy, GIT List

Use the new "git var GIT_EDITOR" feature to decide what editor to
use, instead of duplicating its logic elsewhere.  This should make
the behavior of commands in edge cases (e.g., editor names with
spaces) a little more consistent.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Documentation/config.txt         |    4 +---
 Documentation/git-commit.txt     |    2 +-
 Documentation/git-send-email.txt |    4 ++--
 contrib/fast-import/git-p4       |    5 +----
 git-add--interactive.perl        |    3 +--
 git-send-email.perl              |    3 ++-
 git-sh-setup.sh                  |   19 ++++++-------------
 git-svn.perl                     |    5 ++---
 8 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index d1e2120..5181b77 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -387,9 +387,7 @@ core.editor::
 	Commands such as `commit` and `tag` that lets you edit
 	messages by launching an editor uses the value of this
 	variable when it is set, and the environment variable
-	`GIT_EDITOR` is not set.  The order of preference is
-	`GIT_EDITOR` environment, `core.editor`, `VISUAL` and
-	`EDITOR` environment variables and then finally `vi`.
+	`GIT_EDITOR` is not set.  See linkgit:git-var[1].
 
 core.pager::
 	The command that git will use to paginate output.  Can
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 0578a40..3ea80c8 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -323,7 +323,7 @@ ENVIRONMENT AND CONFIGURATION VARIABLES
 The editor used to edit the commit log message will be chosen from the
 GIT_EDITOR environment variable, the core.editor configuration variable, the
 VISUAL environment variable, or the EDITOR environment variable (in that
-order).
+order).  See linkgit:git-var[1] for details.
 
 HOOKS
 -----
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 767cf4d..c85d7f4 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -60,8 +60,8 @@ The --bcc option must be repeated for each user you want on the bcc list.
 The --cc option must be repeated for each user you want on the cc list.
 
 --compose::
-	Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an
-	introductory message for the patch series.
+	Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1])
+	to edit an introductory message for the patch series.
 +
 When '--compose' is used, git send-email will use the From, Subject, and
 In-Reply-To headers specified in the message. If the body of the message
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index e710219..48059d0 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -729,13 +729,10 @@ class P4Submit(Command):
             tmpFile.write(submitTemplate + separatorLine + diff + newdiff)
             tmpFile.close()
             mtime = os.stat(fileName).st_mtime
-            defaultEditor = "vi"
-            if platform.system() == "Windows":
-                defaultEditor = "notepad"
             if os.environ.has_key("P4EDITOR"):
                 editor = os.environ.get("P4EDITOR")
             else:
-                editor = os.environ.get("EDITOR", defaultEditor);
+                editor = read_pipe("git var GIT_EDITOR")
             system(editor + " " + fileName)
 
             response = "y"
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 69aeaf0..0c74e5c 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -987,8 +987,7 @@ sub edit_hunk_manually {
 EOF
 	close $fh;
 
-	my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor")
-		|| $ENV{VISUAL} || $ENV{EDITOR} || "vi";
+	chomp(my $editor = run_cmd_pipe(qw(git var GIT_EDITOR)));
 	system('sh', '-c', $editor.' "$@"', $editor, $hunkfile);
 
 	if ($? != 0) {
diff --git a/git-send-email.perl b/git-send-email.perl
index a0279de..4f5da4e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -162,7 +162,8 @@ my $compose_filename;
 
 # Handle interactive edition of files.
 my $multiedit;
-my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
+my $editor = Git::command_oneline('var', 'GIT_EDITOR');
+
 sub do_edit {
 	if (defined($multiedit) && !$multiedit) {
 		map {
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index c41c2f7..99cceeb 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -99,19 +99,12 @@ set_reflog_action() {
 }
 
 git_editor() {
-	: "${GIT_EDITOR:=$(git config core.editor)}"
-	: "${GIT_EDITOR:=${VISUAL:-${EDITOR}}}"
-	case "$GIT_EDITOR,$TERM" in
-	,dumb)
-		echo >&2 "No editor specified in GIT_EDITOR, core.editor, VISUAL,"
-		echo >&2 "or EDITOR. Tried to fall back to vi but terminal is dumb."
-		echo >&2 "Please set one of these variables to an appropriate"
-		echo >&2 "editor or run $0 with options that will not cause an"
-		echo >&2 "editor to be invoked (e.g., -m or -F for git-commit)."
-		exit 1
-		;;
-	esac
-	eval "${GIT_EDITOR:=vi}" '"$@"'
+	if test -z "${GIT_EDITOR:+set}"
+	then
+		GIT_EDITOR="$(git var GIT_EDITOR)" || return $?
+	fi
+
+	eval "$GIT_EDITOR" '"$@"'
 }
 
 is_bare_repository () {
diff --git a/git-svn.perl b/git-svn.perl
index 6a3b501..42c9a72 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1321,9 +1321,8 @@ sub get_commit_entry {
 	close $log_fh or croak $!;
 
 	if ($_edit || ($type eq 'tree')) {
-		my $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi';
-		# TODO: strip out spaces, comments, like git-commit.sh
-		system($editor, $commit_editmsg);
+		chomp(my $editor = command_oneline(qw(var GIT_EDITOR)));
+		system('sh', '-c', $editor.' "$@"', $editor, $commit_editmsg);
 	}
 	rename $commit_editmsg, $commit_msg or croak $!;
 	{
-- 
1.6.5.2

^ permalink raw reply related	[relevance 51%]

* [PATCH] send-email: Allow sleeping between sending mails
@ 2007-12-08 17:12 51% Dan Nicholson
  0 siblings, 0 replies; 200+ results
From: Dan Nicholson @ 2007-12-08 17:12 UTC (permalink / raw)
  To: git

Sometimes when sending many mails, the thread appears out of order for
the recipient. This adds a simple workaround by sleeping between sending
mails. This is controlled by the option --sleep, which defaults to 0.

Since the perl builtin function sleep is used, only integer granularity
is offered. GetOptions seems to perform the necessary checking for this.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
---
 Documentation/git-send-email.txt |    5 +++++
 git-send-email.perl              |   14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 659215a..45341db 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -71,6 +71,11 @@ The --cc option must be repeated for each user you want on the cc list.
         Default is the value of 'sendemail.signedoffcc' configuration value;
         if that is unspecified, default to --signed-off-by-cc.
 
+--sleep::
+	Specify an integer number of seconds to sleep between sending
+	mails. This can help when sending many mails at once and they
+	appear out of order for the recipient. Defaults to 0.
+
 --quiet::
 	Make git-send-email less verbose.  One line per email should be
 	all that is output.
diff --git a/git-send-email.perl b/git-send-email.perl
index 76baa8e..a105306 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -100,6 +100,9 @@ Options:
 
    --envelope-sender	Specify the envelope sender used to send the emails.
 
+   --sleep        Specify an integer number of seconds to sleep between
+                  sending mails. Defaults to 0.
+
 EOT
 	exit(1);
 }
@@ -158,6 +161,7 @@ my (@to,@cc,@initial_cc,@bcclist,@xh,
 	$initial_reply_to,$initial_subject,@files,$author,$sender,$compose,$time);
 
 my $envelope_sender;
+my $mail_index;
 
 # Example reply to:
 #$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
@@ -171,7 +175,7 @@ if ($@) {
 }
 
 # Behavior modification variables
-my ($quiet, $dry_run) = (0, 0);
+my ($quiet, $dry_run, $sleep_time) = (0, 0, 0);
 
 # Variables with corresponding config settings
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
@@ -222,6 +226,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
+		    "sleep=i" => \$sleep_time,
 	 );
 
 unless ($rc) {
@@ -669,6 +674,7 @@ X-Mailer: git-send-email $gitversion
 $reply_to = $initial_reply_to;
 $references = $initial_reply_to || '';
 $subject = $initial_subject;
+$mail_index = 0;
 
 foreach my $t (@files) {
 	open(F,"<",$t) or die "can't open file $t";
@@ -803,6 +809,12 @@ foreach my $t (@files) {
 			$references = "$message_id";
 		}
 	}
+
+	# sleep if requested and there are any mails left
+	if ($sleep_time > 0 && $mail_index < $#files) {
+		sleep $sleep_time;
+	}
+	$mail_index++;
 }
 
 if ($compose) {
-- 
1.5.3.2

^ permalink raw reply related	[relevance 51%]

* [PATCH 7/9] send-email: implement sendmail aliases line continuation support
  @ 2015-05-31 22:29 51% ` Eric Sunshine
  0 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2015-05-31 22:29 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Allen Hubbe, Eric Sunshine

Logical lines in sendmail aliases files can be spread over multiple
physical lines[1]. A line beginning with whitespace is folded into the
preceding line. A line ending with '\' consumes the following line.

[1]: https://www.freebsd.org/cgi/man.cgi?query=aliases&sektion=5

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---

This implementation silently and "sanely" tolerates continuation line
scenarios for which behavior is not defined by [1]. In particular, an
indented line which is the first (non-comment) line in the file is
treated as a single logical line. Ditto for a line ending with '\' which
is the last (non-comment) line in the file.

An earlier iteration emitted warnings for such cases, but it wasn't
clear if warning about undefined behavior was useful; and it made the
implementation much more noisy, so this version silently tolerates such
anomalies.

 Documentation/git-send-email.txt |  2 --
 git-send-email.perl              | 10 +++++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index e6d466e..7ae467b 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -394,8 +394,6 @@ described below:
 sendmail;;
 *	Quoted aliases and quoted addresses are not supported: lines that
 	contain a `"` symbol are ignored.
-*	Line continuations are not supported: lines that start with
-	whitespace characters, or end with a `\` symbol are ignored.
 *	Redirection to a file (`/path/name`) or pipe (`|command`) is not
 	supported.
 *	File inclusion (`:include: /path/name`) is not supported.
diff --git a/git-send-email.perl b/git-send-email.perl
index e777bd3..eb1d678 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -492,8 +492,6 @@ sub parse_sendmail_alias {
 	local $_ = shift;
 	if (/"/) {
 		print STDERR "warning: sendmail alias with quotes is not supported: $_\n";
-	} elsif (/^\s|\\$/) {
-		print STDERR "warning: sendmail continuation line is not supported: $_\n";
 	} elsif (/^(\S+?)\s*:\s*(.+)$/) {
 		my ($alias, $addr) = ($1, $2);
 		$aliases{$alias} = [ split_addrs($addr) ];
@@ -504,10 +502,16 @@ sub parse_sendmail_alias {
 
 sub parse_sendmail_aliases {
 	my $fh = shift;
+	my $s = '';
 	while (<$fh>) {
+		chomp;
 		next if /^\s*$/ || /^\s*#/;
-		parse_sendmail_alias($_);
+		$s .= $_, next if $s =~ s/\\$// || s/^\s+//;
+		parse_sendmail_alias($s) if $s;
+		$s = $_;
 	}
+	$s =~ s/\\$//; # silently tolerate stray '\' on last line
+	parse_sendmail_alias($s) if $s;
 }
 
 my %parse_alias = (
-- 
2.4.2.538.g5f4350e

^ permalink raw reply related	[relevance 51%]

* [PATCH] send-email: Defines smtpPassCmd config option
@ 2020-05-01 10:51 51% Leonardo Bras
  0 siblings, 0 replies; 200+ results
From: Leonardo Bras @ 2020-05-01 10:51 UTC (permalink / raw)
  To: git; +Cc: Leonardo Bras, Jan Viktorin, Michal Nazarewicz

Defines smtpPassCmd config option, to allow the user to pass a command
that is used to output the password.

Its useful for users that store the password encrypted on disk, and
want a easy way to send-email without typing it again.

Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
---
 Documentation/config/sendemail.txt |  1 +
 Documentation/git-send-email.txt   |  5 +++--
 git-send-email.perl                | 11 +++++++++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Documentation/config/sendemail.txt b/Documentation/config/sendemail.txt
index 0006faf800..f71e58862d 100644
--- a/Documentation/config/sendemail.txt
+++ b/Documentation/config/sendemail.txt
@@ -34,6 +34,7 @@ sendemail.from::
 sendemail.multiEdit::
 sendemail.signedoffbycc::
 sendemail.smtpPass::
+sendemail.smtpPassCmd::
 sendemail.suppresscc::
 sendemail.suppressFrom::
 sendemail.to::
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 0a69810147..8e9da5ed64 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -203,8 +203,9 @@ independently of `--smtp-user`
 Furthermore, passwords need not be specified in configuration files
 or on the command line. If a username has been specified (with
 `--smtp-user` or a `sendemail.smtpUser`), but no password has been
-specified (with `--smtp-pass` or `sendemail.smtpPass`), then
-a password is obtained using 'git-credential'.
+specified (with `--smtp-pass` or `sendemail.smtpPass`, or as an output
+of `sendemail.smtpPassCmd`), then a password is obtained using
+'git-credential'.
 
 --no-smtp-auth::
 	Disable SMTP authentication. Short hand for `--smtp-auth=none`
diff --git a/git-send-email.perl b/git-send-email.perl
index dc95656f75..d953ebb058 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -170,6 +170,7 @@ sub format_2822_time {
 my $smtp;
 my $auth;
 my $num_sent = 0;
+my $smtp_authpass_cmd;
 
 # Regexes for RFC 2047 productions.
 my $re_token = qr/[^][()<>@,;:\\"\/?.= \000-\037\177-\377]+/;
@@ -271,6 +272,7 @@ sub do_edit {
     "smtpserveroption" => \@smtp_server_options,
     "smtpuser" => \$smtp_authuser,
     "smtppass" => \$smtp_authpass,
+    "smtppasscmd" => \$smtp_authpass_cmd,
     "smtpdomain" => \$smtp_domain,
     "smtpauth" => \$smtp_auth,
     "smtpbatchsize" => \$batch_size,
@@ -1303,6 +1305,15 @@ sub smtp_auth_maybe {
 		die "invalid smtp auth: '${smtp_auth}'";
 	}
 
+	# Check password command if password was not provided.
+	if(!defined $smtp_authpass && defined $smtp_authpass_cmd){
+		open my $pass, "$smtp_authpass_cmd |"
+			or die sprintf(__("Could not execute '%s'"), $smtp_authpass_cmd);
+		#Cut newline char
+		$smtp_authpass = substr <$pass>, 0, -1;
+		close($pass);
+	}
+
 	# TODO: Authentication may fail not because credentials were
 	# invalid but due to other reasons, in which we should not
 	# reject credentials.
-- 
2.25.4


^ permalink raw reply related	[relevance 51%]

* [PATCH v2 3/3] New send-email option smtpserveroption.
  @ 2010-09-04 19:55 51% ` Pascal Obry
  0 siblings, 0 replies; 200+ results
From: Pascal Obry @ 2010-09-04 19:55 UTC (permalink / raw)
  To: git; +Cc: Pascal Obry

The new command line parameter --smtp-server-option or default
configuration sendemail.smtpserveroption can be used to pass
specific options to the SMTP server. Update the documentation
accordingly.
---
 Documentation/git-send-email.txt |    8 ++++++++
 git-send-email.perl              |    8 +++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index c283084..ed30be8 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -157,6 +157,14 @@ user is prompted for a password while the input is masked for privacy.
 	`/usr/lib/sendmail` if such program is available, or
 	`localhost` otherwise.
 
+--smtp-server-option=<options>::
+	If set, specifies the outgoing SMTP server option to use.
+	Default value can be specified by the 'sendemail.smtpserveroption'
+	configuration option.
++
+The --smtp-server-option option must be repeated for each option you want
+to pass to the server.
+
 --smtp-server-port=<port>::
 	Specifies a port different from the default port (SMTP
 	servers typically listen to smtp port 25, but may also listen to
diff --git a/git-send-email.perl b/git-send-email.perl
index 39cb5af..47989fe 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -60,6 +60,7 @@ git send-email [options] <file | directory | rev-list options >
     --envelope-sender       <str>  * Email envelope sender.
     --smtp-server       <str:int>  * Outgoing SMTP server to use. The port
                                      is optional. Default 'localhost'.
+    --smtp-server-option    <str>  * Outgoing SMTP server option to use.
     --smtp-server-port      <int>  * Outgoing SMTP server port.
     --smtp-user             <str>  * Username for SMTP-AUTH.
     --smtp-pass             <str>  * Password for SMTP-AUTH; not necessary.
@@ -188,7 +189,8 @@ sub do_edit {
 
 # Variables with corresponding config settings
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
-my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
+my ($smtp_server, $smtp_server_port, @smtp_server_options);
+my ($smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
 my ($validate, $confirm);
 my (@suppress_cc);
@@ -210,6 +212,7 @@ my %config_bool_settings = (
 my %config_settings = (
     "smtpserver" => \$smtp_server,
     "smtpserverport" => \$smtp_server_port,
+    "smtpserveroption" => \@smtp_server_options,
     "smtpuser" => \$smtp_authuser,
     "smtppass" => \$smtp_authpass,
     "smtpdomain" => \$smtp_domain,
@@ -279,6 +282,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "no-bcc" => \$no_bcc,
 		    "chain-reply-to!" => \$chain_reply_to,
 		    "smtp-server=s" => \$smtp_server,
+		    "smtp-server-option=s" => \@smtp_server_options,
 		    "smtp-server-port=s" => \$smtp_server_port,
 		    "smtp-user=s" => \$smtp_authuser,
 		    "smtp-pass:s" => \$smtp_authpass,
@@ -1015,6 +1019,8 @@ X-Mailer: git-send-email $gitversion
 		}
 	}
 
+	unshift (@sendmail_parameters, @smtp_server_options);
+
 	if ($dry_run) {
 		# We don't want to send the email.
 	} elsif ($smtp_server =~ m#^/#) {
-- 
1.7.2.2.277.gb49c4

^ permalink raw reply related	[relevance 51%]

* [PATCH v3 3/3] New send-email option smtpserveroption.
  @ 2010-09-05 17:49 51% ` Pascal Obry
  0 siblings, 0 replies; 200+ results
From: Pascal Obry @ 2010-09-05 17:49 UTC (permalink / raw)
  To: git; +Cc: Pascal Obry

The new command line parameter --smtp-server-option or default
configuration sendemail.smtpserveroption can be used to pass
specific options to the SMTP server. Update the documentation
accordingly.
---
 Documentation/git-send-email.txt |    8 ++++++++
 git-send-email.perl              |    8 +++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index c283084..5af05bc 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -157,6 +157,14 @@ user is prompted for a password while the input is masked for privacy.
 	`/usr/lib/sendmail` if such program is available, or
 	`localhost` otherwise.
 
+--smtp-server-option=<option>::
+	If set, specifies the outgoing SMTP server option to use.
+	Default value can be specified by the 'sendemail.smtpserveroption'
+	configuration option.
++
+The --smtp-server-option option must be repeated for each option you want
+to pass to the server.
+
 --smtp-server-port=<port>::
 	Specifies a port different from the default port (SMTP
 	servers typically listen to smtp port 25, but may also listen to
diff --git a/git-send-email.perl b/git-send-email.perl
index 39cb5af..47989fe 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -60,6 +60,7 @@ git send-email [options] <file | directory | rev-list options >
     --envelope-sender       <str>  * Email envelope sender.
     --smtp-server       <str:int>  * Outgoing SMTP server to use. The port
                                      is optional. Default 'localhost'.
+    --smtp-server-option    <str>  * Outgoing SMTP server option to use.
     --smtp-server-port      <int>  * Outgoing SMTP server port.
     --smtp-user             <str>  * Username for SMTP-AUTH.
     --smtp-pass             <str>  * Password for SMTP-AUTH; not necessary.
@@ -188,7 +189,8 @@ sub do_edit {
 
 # Variables with corresponding config settings
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
-my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
+my ($smtp_server, $smtp_server_port, @smtp_server_options);
+my ($smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
 my ($validate, $confirm);
 my (@suppress_cc);
@@ -210,6 +212,7 @@ my %config_bool_settings = (
 my %config_settings = (
     "smtpserver" => \$smtp_server,
     "smtpserverport" => \$smtp_server_port,
+    "smtpserveroption" => \@smtp_server_options,
     "smtpuser" => \$smtp_authuser,
     "smtppass" => \$smtp_authpass,
     "smtpdomain" => \$smtp_domain,
@@ -279,6 +282,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "no-bcc" => \$no_bcc,
 		    "chain-reply-to!" => \$chain_reply_to,
 		    "smtp-server=s" => \$smtp_server,
+		    "smtp-server-option=s" => \@smtp_server_options,
 		    "smtp-server-port=s" => \$smtp_server_port,
 		    "smtp-user=s" => \$smtp_authuser,
 		    "smtp-pass:s" => \$smtp_authpass,
@@ -1015,6 +1019,8 @@ X-Mailer: git-send-email $gitversion
 		}
 	}
 
+	unshift (@sendmail_parameters, @smtp_server_options);
+
 	if ($dry_run) {
 		# We don't want to send the email.
 	} elsif ($smtp_server =~ m#^/#) {
-- 
1.7.2.3.316.ga4c47

^ permalink raw reply related	[relevance 51%]

* [PATCHv4] send-email: Ask if a patch should be sent twice
@ 2019-07-30 21:24 51% Dmitry Safonov
  0 siblings, 0 replies; 200+ results
From: Dmitry Safonov @ 2019-07-30 21:24 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Dmitry Safonov, SZEDER Gábor, Dmitry Safonov, Andrei Vagin

I was almost certain that git won't let me send the same patch twice,
but today I've managed to double-send a directory by a mistake:
	git send-email --to linux-kernel@vger.kernel.org /tmp/timens/
	    --cc 'Dmitry Safonov <0x7f454c46@gmail.com>' /tmp/timens/`

[I haven't noticed that I put the directory twice ^^]

Prevent this shipwreck from happening again by asking if a patch
is sent multiple times on purpose.

link: https://lkml.kernel.org/r/4d53ebc7-d5b2-346e-c383-606401d19d3a@gmail.com
Cc: Andrei Vagin <avagin@openvz.org>
Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
v4: Don't fail the test with GIT_TEST_GETTEXT_POISON=true
v3: Use `test_i18ngrep` instead of plain `grep`
v2: Moved the check under --validate,
    fixed tests,
    added a new test,
    updated documentation for --validate

 Documentation/git-send-email.txt |  2 ++
 git-send-email.perl              | 14 ++++++++++++++
 t/t9001-send-email.sh            | 15 +++++++++++++++
 3 files changed, 31 insertions(+)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index d93e5d0f58f0..0441bb1b5d3b 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -421,6 +421,8 @@ have been specified, in which case default to 'compose'.
 			('auto', 'base64', or 'quoted-printable') is used;
 			this is due to SMTP limits as described by
 			http://www.ietf.org/rfc/rfc5322.txt.
+		*	Ask confirmation before sending patches multiple times
+			if the supplied patches set overlaps.
 --
 +
 Default is the value of `sendemail.validate`; if this is not set,
diff --git a/git-send-email.perl b/git-send-email.perl
index 5f92c89c1c1b..c1638d06f81d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -688,6 +688,9 @@ sub is_format_patch_arg {
 @files = handle_backup_files(@files);
 
 if ($validate) {
+	my %seen;
+	my @dupes = grep { $seen{$_}++ } @files;
+
 	foreach my $f (@files) {
 		unless (-p $f) {
 			my $error = validate_patch($f, $target_xfer_encoding);
@@ -695,6 +698,17 @@ sub is_format_patch_arg {
 						  $f, $error);
 		}
 	}
+	if (@dupes) {
+		printf(__("Patches specified several times: \n"));
+		printf(__("%s \n" x @dupes), @dupes);
+		$_ = ask(__("Do you want to send those patches several times? Y/n "),
+			default => "y",
+			valid_re => qr/^(?:yes|y|no|n)/i);
+		if (/^n/i) {
+			cleanup_compose_files();
+			exit(0);
+		}
+	}
 }
 
 if (@files) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 997f90b42b3e..8954f8e38d90 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -555,6 +555,7 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
 		--no-chain-reply-to \
 		--in-reply-to="$(cat expect)" \
 		--smtp-server="$(pwd)/fake.sendmail" \
+		--no-validate \
 		$patches $patches $patches \
 		2>errors &&
 	# The first message is a reply to --in-reply-to
@@ -577,6 +578,7 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
 		--chain-reply-to \
 		--in-reply-to="$(cat expect)" \
 		--smtp-server="$(pwd)/fake.sendmail" \
+		--no-validate \
 		$patches $patches $patches \
 		2>errors &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
@@ -589,6 +591,19 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
 	test_cmp expect actual
 '
 
+test_expect_success $PREREQ 'ask confirmation for double-send' '
+	clean_fake_sendmail &&
+	echo y | \
+		GIT_SEND_EMAIL_NOTTY=1 \
+		git send-email --from=author@example.com \
+			--to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--validate \
+			$patches $patches $patches \
+			>stdout &&
+	test_i18ngrep ! "Patches specified several times: " stdout
+'
+
 test_expect_success $PREREQ 'setup fake editor' '
 	write_script fake-editor <<-\EOF
 	echo fake edit >>"$1"
-- 
2.22.0


^ permalink raw reply related	[relevance 51%]

* [PATCH v3] send-email: auth plain/login fix
    2011-09-27 21:36 52% ` [PATCH v2] " Zbigniew Jędrzejewski-Szmek
@ 2011-09-28 10:26 51% ` Zbigniew Jędrzejewski-Szmek
  1 sibling, 0 replies; 200+ results
From: Zbigniew Jędrzejewski-Szmek @ 2011-09-28 10:26 UTC (permalink / raw)
  To: gitster, joe, git; +Cc: Zbigniew Jędrzejewski-Szmek

git send-email was not authenticating properly when communicating over
TLS with a server supporting only AUTH PLAIN and AUTH LOGIN. This is
e.g. the standard server setup under debian with exim4 and probably
everywhere where system accounts are used.

The problem (only?) exists when libauthen-sasl-cyrus-perl
(Authen::SASL::Cyrus) is installed. Importing Authen::SASL::Perl
makes Authen::SASL use the perl implementation which works
better.

The solution is based on this forum thread:
http://www.perlmonks.org/?node_id=904354.

This patch is tested by sending it :)

Before:
Net::SMTP>>> Net::SMTP(2.31)
Net::SMTP>>>   Net::Cmd(2.29)
Net::SMTP>>>     Exporter(5.64_01)
Net::SMTP>>>   IO::Socket::INET(1.31)
Net::SMTP>>>     IO::Socket(1.31)
Net::SMTP>>>       IO::Handle(1.28)
...
Net::SMTP=GLOB(0x238f668)>>> STARTTLS
Net::SMTP=GLOB(0x238f668)<<< 220 2.0.0 Ready to start TLS
Net::SMTP::SSL=GLOB(0x238f668)>>> EHLO localhost.localdomain
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-yyy.yyy.yyy Hello xxx.xxx [xxx.xxx.xxx.xxx], pleased to meet you
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-PIPELINING
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-8BITMIME
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-SIZE 80000000
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-DSN
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-AUTH=LOGIN PLAIN
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-AUTH LOGIN PLAIN
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-DELIVERBY
Net::SMTP::SSL=GLOB(0x238f668)<<< 250 HELP
Password:
Net::SMTP::SSL=GLOB(0x238f668)>>> AUTH
Net::SMTP::SSL=GLOB(0x238f668)<<< 501 5.5.2 AUTH mechanism must be specified
5.5.2 AUTH mechanism must be specified

After:
Net::SMTP=GLOB(0x1ac4a60)>>> STARTTLS
Net::SMTP=GLOB(0x1ac4a60)<<< 220 2.0.0 Ready to start TLS
Net::SMTP::SSL=GLOB(0x1ac4a60)>>> EHLO localhost.localdomain
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-yyy.yyy.yyy Hello xxx.xxx [xxx.xxx.xxx.xxx], pleased to meet you
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-PIPELINING
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-8BITMIME
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-SIZE 80000000
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-DSN
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-AUTH=LOGIN PLAIN
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-AUTH LOGIN PLAIN
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-DELIVERBY
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250 HELP
Password:
Net::SMTP::SSL=GLOB(0x1ac4a60)>>> AUTH LOGIN
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 334 VXNlcm5hbWU6
Net::SMTP::SSL=GLOB(0x1ac4a60)>>> emJ5c3plaw==
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 334 UGFzc3dvcmQ6
Net::SMTP::SSL=GLOB(0x1ac4a60)>>> dGVzdA==
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 535 5.7.0 authentication failed
5.7.0 authentication failed

The password is incorrect in this snippet, but the protocol works correctly.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
v3:  - the import is performed only if it will be used, and failure is ignored

 git-send-email.perl |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 37dfbe7..dbc435a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1098,6 +1098,10 @@ X-Mailer: git-send-email $gitversion
 		}
 
 		if (defined $smtp_authuser) {
+			eval {
+				require Authen::SASL;
+				Authen::SASL->import(qw(Perl));
+			};
 
 			if (!defined $smtp_authpass) {
 
-- 
1.7.6

^ permalink raw reply related	[relevance 51%]

* [PATCH v2 3/3] git-send-email: rename 'tls' to 'starttls'
    2021-04-11 12:54 56% ` [PATCH v2 2/3] git-send-email: die on invalid smtp_encryption Drew DeVault
@ 2021-04-11 12:54 51% ` Drew DeVault
  1 sibling, 0 replies; 200+ results
From: Drew DeVault @ 2021-04-11 12:54 UTC (permalink / raw)
  To: git; +Cc: Drew DeVault

The name 'tls' is misleading. The 'ssl' option enables a generic
"modern" encryption stack which might very well use TLS; but the 'tls'
option enables STARTTLS support, which works entirely differently.

This renames the canonical option to 'starttls', to make this
distinction more obvious, and adds 'tls' as an alias for starttls, to
avoid breaking config files.

Signed-off-by: Drew DeVault <sir@cmpwn.com>
---
 Documentation/git-send-email.txt |  6 ++++--
 git-send-email.perl              | 10 +++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 520b355e50..f8cea9e1f9 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -168,12 +168,14 @@ Sending
 	unspecified, choosing the envelope sender is left to your MTA.
 
 --smtp-encryption=<encryption>::
-	Specify the encryption to use, either 'ssl' or 'tls'. 'ssl' enables
-	generic SSL/TLS support and is typically used on port 465.  'tls'
+	Specify the encryption to use, either 'ssl' or 'starttls'. 'ssl' enables
+	generic SSL/TLS support and is typically used on port 465.  'starttls'
 	enables in-band STARTTLS support and is typically used on port 25 or
 	587.  Use whichever option is recommended by your mail provider.  Leave
 	empty to disable encryption and use plain SMTP.  Default is the value of
 	`sendemail.smtpEncryption`.
++
+'tls' is an alias for 'starttls' for legacy reasons.
 
 --smtp-domain=<FQDN>::
 	Specifies the Fully Qualified Domain Name (FQDN) used in the
diff --git a/git-send-email.perl b/git-send-email.perl
index bda5211f0d..3f125bc2b8 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -495,8 +495,12 @@ sub read_config {
 
 # 'default' encryption is none -- this only prevents a warning
 $smtp_encryption = '' unless (defined $smtp_encryption);
-if ($smtp_encryption ne "" && $smtp_encryption ne "ssl" && $smtp_encryption ne "tls") {
-	die __("Invalid smtp_encryption configuration: expected 'ssl', 'tls', or nothing.\n");
+if ($smtp_encryption eq "tls") {
+	# "tls" is an alias for starttls for legacy reasons
+	$smtp_encryption = "starttls";
+};
+if ($smtp_encryption ne "" && $smtp_encryption ne "ssl" && $smtp_encryption ne "starttls") {
+	die __("Invalid smtp_encryption configuration: expected 'ssl', 'starttls', or nothing.\n");
 }
 
 # Set CC suppressions
@@ -1541,7 +1545,7 @@ sub send_message {
 						 Hello => $smtp_domain,
 						 Debug => $debug_net_smtp,
 						 Port => $smtp_server_port);
-			if ($smtp_encryption eq 'tls' && $smtp) {
+			if ($smtp_encryption eq 'starttls' && $smtp) {
 				if ($use_net_smtp_ssl) {
 					$smtp->command('STARTTLS');
 					$smtp->response();
-- 
2.31.1


^ permalink raw reply related	[relevance 51%]

* [PATCH v2 03/10] git-send-email.perl: Handle shell metacharacters in $EDITOR properly
  @ 2008-04-10  6:50 51%       ` Bryan Donlan
  0 siblings, 0 replies; 200+ results
From: Bryan Donlan @ 2008-04-10  6:50 UTC (permalink / raw)
  To: git; +Cc: Johannes Sixt, Adam Roben, gitster, Bryan Donlan

This fixes the git-send-perl semantics for launching an editor when
$GIT_EDITOR (or friends) contains shell metacharacters to match
launch_editor() in builtin-tag.c. If we use the current approach
(sh -c '$0 $@' "$EDITOR" files ...), we see it fails when $EDITOR has
shell metacharacters:

$ sh -x -c '$0 $@' "$VISUAL" "foo"
+ "$FAKE_EDITOR" foo
"$FAKE_EDITOR": 1: "$FAKE_EDITOR": not found

Whereas builtin-tag.c will invoke sh -c "$EDITOR \"$@\"".

Thus, this patch changes git-send-email.perl to use the same method as the
C utilities, and additionally updates t/t9001-send-email.sh to test for this bug.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
---
 git-send-email.perl   |    2 +-
 t/t9001-send-email.sh |    8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 9e568bf..b502396 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -512,7 +512,7 @@ EOT
 	close(C);
 
 	my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
-	system('sh', '-c', '$0 $@', $editor, $compose_filename);
+	system('sh', '-c', $editor.' "$@"', $editor, $compose_filename);
 
 	open(C2,">",$compose_filename . ".final")
 		or die "Failed to open $compose_filename.final : " . $!;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c0973b4..030f66c 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -139,15 +139,19 @@ test_expect_success 'Valid In-Reply-To when prompting' '
 
 test_expect_success 'setup fake editor' '
 	(echo "#!/bin/sh" &&
-	 echo "echo fake edit >>\$1"
+	 echo "echo fake edit >>\"\$1\""
 	) >fake-editor &&
 	chmod +x fake-editor
 '
 
+FAKE_EDITOR="$(pwd)/fake-editor"
+export FAKE_EDITOR
+GIT_EDITOR='"$FAKE_EDITOR"'
+export GIT_EDITOR
+
 test_expect_success '--compose works' '
 	clean_fake_sendmail &&
 	echo y | \
-		GIT_EDITOR=$(pwd)/fake-editor \
 		GIT_SEND_EMAIL_NOTTY=1 \
 		git send-email \
 		--compose --subject foo \
-- 
1.5.5.33.gc0a39.dirty

^ permalink raw reply related	[relevance 51%]

* [PATCH v3 03/10] git-send-email.perl: Handle shell metacharacters in $EDITOR properly
  @ 2008-05-04  5:37 52%         ` Bryan Donlan
  0 siblings, 0 replies; 200+ results
From: Bryan Donlan @ 2008-05-04  5:37 UTC (permalink / raw)
  To: git; +Cc: Johannes Sixt, Adam Roben, gitster, Bryan Donlan

This fixes the git-send-perl semantics for launching an editor when
$GIT_EDITOR (or friends) contains shell metacharacters to match
launch_editor() in builtin-tag.c. If we use the current approach
(sh -c '$0 $@' "$EDITOR" files ...), we see it fails when $EDITOR has
shell metacharacters:

$ sh -x -c '$0 $@' "$VISUAL" "foo"
+ "$FAKE_EDITOR" foo
"$FAKE_EDITOR": 1: "$FAKE_EDITOR": not found

Whereas builtin-tag.c will invoke sh -c "$EDITOR \"$@\"".

Thus, this patch changes git-send-email.perl to use the same method as the
C utilities, and additionally updates t/t9001-send-email.sh to test for this bug.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
---
 git-send-email.perl   |    2 +-
 t/t9001-send-email.sh |    8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 9e568bf..b502396 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -512,7 +512,7 @@ EOT
 	close(C);
 
 	my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
-	system('sh', '-c', '$0 $@', $editor, $compose_filename);
+	system('sh', '-c', $editor.' "$@"', $editor, $compose_filename);
 
 	open(C2,">",$compose_filename . ".final")
 		or die "Failed to open $compose_filename.final : " . $!;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c0973b4..030f66c 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -139,15 +139,19 @@ test_expect_success 'Valid In-Reply-To when prompting' '
 
 test_expect_success 'setup fake editor' '
 	(echo "#!/bin/sh" &&
-	 echo "echo fake edit >>\$1"
+	 echo "echo fake edit >>\"\$1\""
 	) >fake-editor &&
 	chmod +x fake-editor
 '
 
+FAKE_EDITOR="$(pwd)/fake-editor"
+export FAKE_EDITOR
+GIT_EDITOR='"$FAKE_EDITOR"'
+export GIT_EDITOR
+
 test_expect_success '--compose works' '
 	clean_fake_sendmail &&
 	echo y | \
-		GIT_EDITOR=$(pwd)/fake-editor \
 		GIT_SEND_EMAIL_NOTTY=1 \
 		git send-email \
 		--compose --subject foo \
-- 
1.5.5.1.128.g03a943

^ permalink raw reply related	[relevance 52%]

* [PATCH] send-email: always confirm by default
  @ 2022-04-22  8:36 52% ` Alyssa Ross
  0 siblings, 0 replies; 200+ results
From: Alyssa Ross @ 2022-04-22  8:36 UTC (permalink / raw)
  To: git, Ævar Arnfjörð Bjarmason; +Cc: Junio C Hamano, Alyssa Ross

For novice users, it can be very intimidating for git send-email to send
off a lot of mail without prompting for confirmation.  These users are
likely to not know it's even possible to configure git to behave
differently.  So let's set a novice-friendly default — expert users who
don't need to be prompted every time will be able to set
sendemail.confirm to their preference, although from my small sample it
sounds plenty of expert users already rely on sendemail.confirm =
always.

I think this is a better idea than defaulting to --dry-run, because
having to specify on the command line that you _really_ want to send the
patches now would mean the --no-dry-run version would quickly end up
being replayed unthinkingly from shell history, and because always
confirming has the nice side effect of making it easy to add patch
commentary.

I also think this approach is better than forbidding the all-in-one
format-patch + send-email, because it wouldn't give an accurate preview
of recipients, because automatic CCs are added by send-email, not
format-patch.  Additionally, teaching git send-email is hard enough
without having to also teach format-patch, and to make sure to clean up
afterwards, etc!

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---

[[ Whoops, sent to the list this time! ]]

Ævar, thanks for encouraging me to send a patch.  At your suggestion,
I've trawled through the list archives looking for any previous
discussion of this default, but I didn't find anything.

 Documentation/git-send-email.txt |  3 +--
 git-send-email.perl              |  2 +-
 t/t9001-send-email.sh            | 14 ++++----------
 3 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 41cd8cb424..b791d83bb7 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -407,8 +407,7 @@ Administering
 --
 +
 Default is the value of `sendemail.confirm` configuration value; if that
-is unspecified, default to 'auto' unless any of the suppress options
-have been specified, in which case default to 'compose'.
+is unspecified, default to 'always'.
 
 --dry-run::
 	Do everything except actually send the emails.
diff --git a/git-send-email.perl b/git-send-email.perl
index 5861e99a6e..4aa7d83cdc 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -606,7 +606,7 @@ sub config_regexp {
 # Set confirm's default value
 my $confirm_unconfigured = !defined $confirm;
 if ($confirm_unconfigured) {
-	$confirm = scalar %suppress_cc ? 'compose' : 'auto';
+	$confirm = 'always';
 };
 # Please update $__git_send_email_confirm_options in
 # git-completion.bash when you add new options.
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 42694fe584..e11730f3dc 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -74,8 +74,8 @@ check_no_confirm () {
 	return 0
 }
 
-test_expect_success $PREREQ 'No confirm with --suppress-cc' '
-	test_no_confirm --suppress-cc=sob &&
+test_expect_success $PREREQ 'No confirm with --confirm=compose --suppress-cc' '
+	test_no_confirm --confirm=compose --suppress-cc=sob &&
 	check_no_confirm
 '
 
@@ -1032,16 +1032,10 @@ test_expect_success $PREREQ '--confirm=compose' '
 	test_confirm --confirm=compose --compose
 '
 
-test_expect_success $PREREQ 'confirm by default (due to cc)' '
+test_expect_success $PREREQ 'confirm by default' '
 	test_when_finished git config sendemail.confirm never &&
 	git config --unset sendemail.confirm &&
-	test_confirm
-'
-
-test_expect_success $PREREQ 'confirm by default (due to --compose)' '
-	test_when_finished git config sendemail.confirm never &&
-	git config --unset sendemail.confirm &&
-	test_confirm --suppress-cc=all --compose
+	test_confirm --suppress-cc=all
 '
 
 test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' '

base-commit: 6cd33dceed60949e2dbc32e3f0f5e67c4c882e1e
-- 
2.35.1


^ permalink raw reply related	[relevance 52%]

* [PATCHv3] send-email: Ask if a patch should be sent twice
@ 2019-07-30 20:33 52% Dmitry Safonov
  0 siblings, 0 replies; 200+ results
From: Dmitry Safonov @ 2019-07-30 20:33 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Dmitry Safonov, SZEDER Gábor, Dmitry Safonov, Andrei Vagin

I was almost certain that git won't let me send the same patch twice,
but today I've managed to double-send a directory by a mistake:
	git send-email --to linux-kernel@vger.kernel.org /tmp/timens/
	    --cc 'Dmitry Safonov <0x7f454c46@gmail.com>' /tmp/timens/`

[I haven't noticed that I put the directory twice ^^]

Prevent this shipwreck from happening again by asking if a patch
is sent multiple times on purpose.

link: https://lkml.kernel.org/r/4d53ebc7-d5b2-346e-c383-606401d19d3a@gmail.com
Cc: Andrei Vagin <avagin@openvz.org>
Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
v3: Use `test_i18ngrep` instead of plain `grep`
v2: Moved the check under --validate,
    fixed tests,
    added a new test,
    updated documentation for --validate

 Documentation/git-send-email.txt |  2 ++
 git-send-email.perl              | 14 ++++++++++++++
 t/t9001-send-email.sh            | 15 +++++++++++++++
 3 files changed, 31 insertions(+)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index d93e5d0f58f0..0441bb1b5d3b 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -421,6 +421,8 @@ have been specified, in which case default to 'compose'.
 			('auto', 'base64', or 'quoted-printable') is used;
 			this is due to SMTP limits as described by
 			http://www.ietf.org/rfc/rfc5322.txt.
+		*	Ask confirmation before sending patches multiple times
+			if the supplied patches set overlaps.
 --
 +
 Default is the value of `sendemail.validate`; if this is not set,
diff --git a/git-send-email.perl b/git-send-email.perl
index 5f92c89c1c1b..c1638d06f81d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -688,6 +688,9 @@ sub is_format_patch_arg {
 @files = handle_backup_files(@files);
 
 if ($validate) {
+	my %seen;
+	my @dupes = grep { $seen{$_}++ } @files;
+
 	foreach my $f (@files) {
 		unless (-p $f) {
 			my $error = validate_patch($f, $target_xfer_encoding);
@@ -695,6 +698,17 @@ sub is_format_patch_arg {
 						  $f, $error);
 		}
 	}
+	if (@dupes) {
+		printf(__("Patches specified several times: \n"));
+		printf(__("%s \n" x @dupes), @dupes);
+		$_ = ask(__("Do you want to send those patches several times? Y/n "),
+			default => "y",
+			valid_re => qr/^(?:yes|y|no|n)/i);
+		if (/^n/i) {
+			cleanup_compose_files();
+			exit(0);
+		}
+	}
 }
 
 if (@files) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 997f90b42b3e..496005af1763 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -555,6 +555,7 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
 		--no-chain-reply-to \
 		--in-reply-to="$(cat expect)" \
 		--smtp-server="$(pwd)/fake.sendmail" \
+		--no-validate \
 		$patches $patches $patches \
 		2>errors &&
 	# The first message is a reply to --in-reply-to
@@ -577,6 +578,7 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
 		--chain-reply-to \
 		--in-reply-to="$(cat expect)" \
 		--smtp-server="$(pwd)/fake.sendmail" \
+		--no-validate \
 		$patches $patches $patches \
 		2>errors &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
@@ -589,6 +591,19 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
 	test_cmp expect actual
 '
 
+test_expect_success $PREREQ 'ask confirmation for double-send' '
+	clean_fake_sendmail &&
+	echo y | \
+		GIT_SEND_EMAIL_NOTTY=1 \
+		git send-email --from=author@example.com \
+			--to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--validate \
+			$patches $patches $patches \
+			>stdout &&
+	! test_i18ngrep "Patches specified several times: " stdout
+'
+
 test_expect_success $PREREQ 'setup fake editor' '
 	write_script fake-editor <<-\EOF
 	echo fake edit >>"$1"
-- 
2.22.0


^ permalink raw reply related	[relevance 52%]

* [PATCH 2/6] send-email: fix non-threaded mails
  @ 2009-06-10  7:16 52%     ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2009-06-10  7:16 UTC (permalink / raw)
  To: Markus Heidelberg; +Cc: git, Michael Witten

From: Markus Heidelberg <markus.heidelberg@web.de>
Date: Mon, 8 Jun 2009 08:43:56 +0200

After commit 3e0c4ff (send-email: respect in-reply-to regardless of
threading, 2009-03-01) the variable $thread was only used for prompting
for an "In-Reply-To", but not for controlling whether the "In-Reply-To"
and "References" fields should be written into the email.

Thus these fields were always used beginning with the second mail and it
was not possible to produce non-threaded mails anymore until commit
15da108 ("send-email: 'References:' should only reference what is sent",
2009-04-13), which introduced a regression with the side effect to make
it possible again when --no-chain-reply-to was set.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * Applies on top of [1/6]

 git-send-email.perl   |    3 ++-
 t/t9001-send-email.sh |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index cccbf45..5d51697 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1137,7 +1137,8 @@ foreach my $t (@files) {
 	send_message();
 
 	# set up for the next message
-	if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
+	if ($thread &&
+		($chain_reply_to || !defined $reply_to || length($reply_to) == 0)) {
 		$reply_to = $message_id;
 		if (length $references > 0) {
 			$references .= "\n $message_id";
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 5bfa36e..8518aca 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -621,7 +621,7 @@ test_expect_success 'in-reply-to but no threading' '
 	grep "In-Reply-To: <in-reply-id@example.com>"
 '
 
-test_expect_failure 'no in-reply-to and no threading' '
+test_expect_success 'no in-reply-to and no threading' '
 	git send-email \
 		--dry-run \
 		--from="Example <nobody@example.com>" \
-- 
1.6.3.2.214.gf4f78e

^ permalink raw reply related	[relevance 52%]

* [PATCH 2/2] send-email: fix non-threaded mails
  @ 2009-06-09  7:11 52% ` Markus Heidelberg
  0 siblings, 0 replies; 200+ results
From: Markus Heidelberg @ 2009-06-09  7:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Markus Heidelberg

After commit 3e0c4ff (send-email: respect in-reply-to regardless of
threading, 2009-03-01) the variable $thread was only used for prompting
for an "In-Reply-To", but not for controlling whether the "In-Reply-To"
and "References" fields should be written into the email.

Thus these fields were always used beginning with the second mail and it
was not possible to produce non-threaded mails anymore until commit
15da108 ("send-email: 'References:' should only reference what is sent",
2009-04-13), which introduced a regression with the side effect to make
it possible again when --no-chain-reply-to was set.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 git-send-email.perl   |    5 ++++-
 t/t9001-send-email.sh |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index cccbf45..3f31b7b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1137,7 +1137,10 @@ foreach my $t (@files) {
 	send_message();
 
 	# set up for the next message
-	if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
+	if ($thread and
+			$chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
+		# with --chain-reply-to every time
+		# else only after the first mail (and only if --in-reply-to was not specified)
 		$reply_to = $message_id;
 		if (length $references > 0) {
 			$references .= "\n $message_id";
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 5bfa36e..8518aca 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -621,7 +621,7 @@ test_expect_success 'in-reply-to but no threading' '
 	grep "In-Reply-To: <in-reply-id@example.com>"
 '
 
-test_expect_failure 'no in-reply-to and no threading' '
+test_expect_success 'no in-reply-to and no threading' '
 	git send-email \
 		--dry-run \
 		--from="Example <nobody@example.com>" \
-- 
1.6.3.2.8.g055bf

^ permalink raw reply related	[relevance 52%]

* [PATCH v4] git-send-email: use ! to indicate relative path to command
  @ 2021-05-11 20:40 52% ` Gregory Anders
  0 siblings, 0 replies; 200+ results
From: Gregory Anders @ 2021-05-11 20:40 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Gregory Anders

Presently, the smtpServer config option can use a sendmail-like program
by providing an absolute path to the program as the value for this
option. However, an absolute path is not always portable and it is often
preferable to simply specify a program name and have `git-send-email`
find that program on $PATH.

For example, if a user wishes to use msmtp to send emails, they might
be able to simply use

    [sendemail]
            smtpServer = !msmtp

instead of using the full path. This is particularly useful when a
common git config file is used across multiple systems where the
absolute path to a given program may differ.

To that end, this patch allows the smtpServer config option to be
prefixed with a ! character that implements the above behavior; namely,
the specified value (sans the ! character) is used as if the user had
entered it directly on the command line.

See also https://lore.kernel.org/git/YJrH8uqzapnpNEsb@gpanders.com/.

Signed-off-by: Gregory Anders <greg@gpanders.com>
---
 Documentation/git-send-email.txt | 13 +++++++------
 git-send-email.perl              |  7 +++++--
 t/t9001-send-email.sh            | 10 ++++++++++
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 93708aefea..418e66c703 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -212,12 +212,13 @@ a password is obtained using 'git-credential'.
 --smtp-server=<host>::
 	If set, specifies the outgoing SMTP server to use (e.g.
 	`smtp.example.com` or a raw IP address).  Alternatively it can
-	specify a full pathname of a sendmail-like program instead;
-	the program must support the `-i` option.  Default value can
-	be specified by the `sendemail.smtpServer` configuration
-	option; the built-in default is to search for `sendmail` in
-	`/usr/sbin`, `/usr/lib` and $PATH if such program is
-	available, falling back to `localhost` otherwise.
+	specify a sendmail-like program instead, either by a full
+	path-name or by prefixing the program name with `!`.  The
+	program must support the `-i` option.  Default value can be
+	specified by the `sendemail.smtpServer` configuration option;
+	the built-in default is to search for `sendmail` in `/usr/sbin`,
+	`/usr/lib` and $PATH if such program is available, falling back
+	to `localhost` otherwise.
 
 --smtp-server-port=<port>::
 	Specifies a port different from the default port (SMTP
diff --git a/git-send-email.perl b/git-send-email.perl
index 175da07d94..022dcf0999 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1492,11 +1492,14 @@ sub send_message {
 
 	if ($dry_run) {
 		# We don't want to send the email.
-	} elsif (file_name_is_absolute($smtp_server)) {
+	} elsif (file_name_is_absolute($smtp_server) || $smtp_server =~ /^!/) {
+		my $prog = $smtp_server;
+		$prog =~ s/^!//;
+
 		my $pid = open my $sm, '|-';
 		defined $pid or die $!;
 		if (!$pid) {
-			exec($smtp_server, @sendmail_parameters) or die $!;
+			exec($prog, @sendmail_parameters) 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 65b3035371..14cc61ace7 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -2225,4 +2225,14 @@ test_expect_success $PREREQ 'test forbidSendmailVariables behavior override' '
 		HEAD^
 '
 
+test_expect_success $PREREQ 'test using a command for smtpServer with !' '
+	clean_fake_sendmail &&
+	PATH="$(pwd):$PATH" \
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="!fake.sendmail" \
+		$patches 2>errors
+'
+
 test_done
-- 
2.31.1.576.g2f8a831619


^ permalink raw reply related	[relevance 52%]

* [PATCH] Add --skip-from-cc option to git-send-email to prevent mailing to From: and Cc: addresses in patch headers
@ 2007-06-16 14:00 52% Alex Unleashed, Alex Unleashed
  0 siblings, 0 replies; 200+ results
From: Alex Unleashed, Alex Unleashed @ 2007-06-16 14:00 UTC (permalink / raw)
  To: git

This applies only to From: and Cc: lines in headers, not the body, so
that --no-signed-off-by-cc still applies for those.

Signed-off-by: Alex Unleashed <unledev@gmail.com>

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 946bd76..7c9fded 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -67,6 +67,10 @@ The --cc option must be repeated for each user you want on the cc list.
 	Make git-send-email less verbose.  One line per email should be
 	all that is output.
 
+--skip-from-cc::
+	Do not add emails found in From: or Cc: headers in patches.
+	Note that this does not apply to addresses in patch bodies.
+
 --smtp-server::
 	If set, specifies the outgoing SMTP server to use (e.g.
 	`smtp.example.com` or a raw IP address).  Alternatively it can
diff --git a/git-send-email.perl b/git-send-email.perl
index 7c0c90b..35a0e6c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -68,6 +68,9 @@ Options:
                  that appear in Signed-off-by: or Cc: lines to the cc:
                  list.  Note: Using this option is not recommended.
 
+   --skip-from-cc Do not send email to From: and Cc: addresses from headers
+                  in patches.
+
    --smtp-server  If set, specifies the outgoing SMTP server to use.
                   Defaults to localhost.
 
@@ -139,7 +142,7 @@ my (@to,@cc,@initial_cc,@bcclist,@xh,
 
 # Behavior modification variables
 my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
-	$dry_run) = (1, 0, 0, 0, 0);
+	$skip_from_cc, $dry_run) = (1, 0, 0, 0, 0, 0);
 my $smtp_server;
 my $envelope_sender;
 
@@ -179,6 +182,7 @@ my $rc = GetOptions("from=s" => \$from,
 		    "quiet" => \$quiet,
 		    "suppress-from" => \$suppress_from,
 		    "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
+		    "skip-from-cc" => \$skip_from_cc,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 	 );
@@ -560,7 +564,7 @@ foreach my $t (@files) {
 				if (/^Subject:\s+(.*)$/) {
 					$subject = $1;
 
-				} elsif (/^(Cc|From):\s+(.*)$/) {
+				} elsif (!$skip_from_cc && /^(Cc|From):\s+(.*)$/) {
 					if (unquote_rfc2047($2) eq $from) {
 						$from = $2;
 						next if ($suppress_from);
@@ -583,7 +587,7 @@ foreach my $t (@files) {
 				# line 2 = subject
 				# So let's support that, too.
 				$input_format = 'lots';
-				if (@cc == 0) {
+				if (!$skip_from_cc && @cc == 0) {
 					printf("(non-mbox) Adding cc: %s from line '%s'\n",
 						$_, $_) unless $quiet;
 
-- 
1.5.2.1

^ permalink raw reply related	[relevance 52%]

* [PATCH] send-email: Add CCs from additional commit tags
@ 2015-03-06 21:59 52% Soren Brinkmann
  0 siblings, 0 replies; 200+ results
From: Soren Brinkmann @ 2015-03-06 21:59 UTC (permalink / raw)
  To: gitster; +Cc: git, Soren Brinkmann

Add email addresses from additional commonly used tags to the CC-list of
patches. Additional tags are:
 - Acked-by
 - Reviewed-by
 - Tested-by
 - Reported-by
 - Reviewed-and-tested-by

--suppress-cc=ack suppresses these additional CCs.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
 Documentation/git-send-email.txt | 3 +++
 git-send-email.perl              | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index f248a8665e1f..1b521446ca11 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -293,6 +293,9 @@ Automating
   patch body (commit message) except for self (use 'self' for that).
 - 'sob' will avoid including anyone mentioned in Signed-off-by lines except
    for self (use 'self' for that).
+- 'ack' will avoid including anyone who acked the  patch (mentioned in
+  Acked-by, Reviewed-by, Tested-by, Reviewed-and-tested-by lines except for
+  self (use 'self' for that).
 - 'cccmd' will avoid running the --cc-cmd.
 - 'body' is equivalent to 'sob' + 'bodycc'
 - 'all' will suppress all auto cc values.
diff --git a/git-send-email.perl b/git-send-email.perl
index 3092ab356c76..18eb8a5139a4 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -407,7 +407,7 @@ my(%suppress_cc);
 if (@suppress_cc) {
 	foreach my $entry (@suppress_cc) {
 		die "Unknown --suppress-cc field: '$entry'\n"
-			unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc)$/;
+			unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc|ack)$/;
 		$suppress_cc{$entry} = 1;
 	}
 }
@@ -1452,7 +1452,7 @@ foreach my $t (@files) {
 	# Now parse the message body
 	while(<$fh>) {
 		$message .=  $_;
-		if (/^(Signed-off-by|Cc): (.*)$/i) {
+		if (/^(Signed-off-by|Cc|Acked-by|Reviewed-by|Tested-by|Reported-by|Reviewed-and-tested-by): (.*)$/i) {
 			chomp;
 			my ($what, $c) = ($1, $2);
 			chomp $c;
@@ -1462,6 +1462,7 @@ foreach my $t (@files) {
 			} else {
 				next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
 				next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
+				next if $suppress_cc{'ack'} and $what =~ /(Acked-by|Reviewed-by|Tested-by|Reported-by|Reviewed-and-tested-by)/i;
 			}
 			push @cc, $c;
 			printf("(body) Adding cc: %s from line '%s'\n",
-- 
2.3.1.2.g90df61e.dirty

^ permalink raw reply related	[relevance 52%]

* [PATCH v3 1/2] perl: bump the required Perl version to 5.8.1 from 5.8.0
  @ 2023-11-16 19:30 52% ` Todd Zullinger
  0 siblings, 0 replies; 200+ results
From: Todd Zullinger @ 2023-11-16 19:30 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jeff King, Ævar Arnfjörð Bjarmason,
	Ondřej Pohořelský

The following commit will make use of a Getopt::Long feature which is
only present in Perl >= 5.8.1.  Document that as the minimum version we
support.

Many of our Perl scripts will continue to run with 5.8.0 but this change
allows us to adjust them as needed without breaking any promises to our
users.

The Perl requirement was last changed in d48b284183 (perl: bump the
required Perl version to 5.8 from 5.6.[21], 2010-09-24).  At that time,
5.8.0 was 8 years old.  It is now over 21 years old.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
I debated changing all the 'use 5.008;' lines here, as most don't
actually require a newer Perl, but the previous bump did the same.

I can see the merit in either direction.

Changing it allows future contributors to be confident in relying on
5.8.1 features.

Not changing it allows anyone stuck on 5.8.0 to continue using the perl
scripts which don't actually require 5.8.1.

Tangentially, the Perl docs for 'use' function recommend against the
5.008001 form[1]:

    Specifying VERSION as a numeric argument of the form 5.024001 should
    generally be avoided as older less readable syntax compared to
    v5.24.1. Before perl 5.8.0 released in 2002 the more verbose numeric
    form was the only supported syntax, which is why you might see it in
    older code.

        use v5.24.1;    # compile time version check
        use 5.24.1;     # ditto
        use 5.024_001;  # ditto; older syntax compatible with perl 5.6

I'm not enough of a Perl coder to have a strong preference or desire to
push for such a change, but I thought it was worth mentioning in case
others wonder why we're using the 5.008001 form.

[1] https://perldoc.perl.org/functions/use#use-VERSION

 Documentation/CodingGuidelines          | 2 +-
 INSTALL                                 | 2 +-
 contrib/diff-highlight/DiffHighlight.pm | 2 +-
 contrib/mw-to-git/Git/Mediawiki.pm      | 2 +-
 git-archimport.perl                     | 2 +-
 git-cvsexportcommit.perl                | 2 +-
 git-cvsimport.perl                      | 2 +-
 git-cvsserver.perl                      | 2 +-
 git-send-email.perl                     | 4 ++--
 git-svn.perl                            | 2 +-
 gitweb/INSTALL                          | 2 +-
 gitweb/gitweb.perl                      | 2 +-
 perl/Git.pm                             | 2 +-
 perl/Git/I18N.pm                        | 2 +-
 perl/Git/LoadCPAN.pm                    | 2 +-
 perl/Git/LoadCPAN/Error.pm              | 2 +-
 perl/Git/LoadCPAN/Mail/Address.pm       | 2 +-
 perl/Git/Packet.pm                      | 2 +-
 t/t0202/test.pl                         | 2 +-
 t/t5562/invoke-with-content-length.pl   | 2 +-
 t/t9700/test.pl                         | 2 +-
 t/test-terminal.perl                    | 2 +-
 22 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 8d3a467c01..39b9b7260f 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -490,7 +490,7 @@ For Perl programs:
 
  - Most of the C guidelines above apply.
 
- - We try to support Perl 5.8 and later ("use Perl 5.008").
+ - We try to support Perl 5.8.1 and later ("use Perl 5.008001").
 
  - use strict and use warnings are strongly preferred.
 
diff --git a/INSTALL b/INSTALL
index 4b42288882..06f29a8ae7 100644
--- a/INSTALL
+++ b/INSTALL
@@ -119,7 +119,7 @@ Issues of note:
 	- A POSIX-compliant shell is required to run some scripts needed
 	  for everyday use (e.g. "bisect", "request-pull").
 
-	- "Perl" version 5.8 or later is needed to use some of the
+	- "Perl" version 5.8.1 or later is needed to use some of the
 	  features (e.g. sending patches using "git send-email",
 	  interacting with svn repositories with "git svn").  If you can
 	  live without these, use NO_PERL.  Note that recent releases of
diff --git a/contrib/diff-highlight/DiffHighlight.pm b/contrib/diff-highlight/DiffHighlight.pm
index 376f577737..636add6968 100644
--- a/contrib/diff-highlight/DiffHighlight.pm
+++ b/contrib/diff-highlight/DiffHighlight.pm
@@ -1,6 +1,6 @@
 package DiffHighlight;
 
-use 5.008;
+use 5.008001;
 use warnings FATAL => 'all';
 use strict;
 
diff --git a/contrib/mw-to-git/Git/Mediawiki.pm b/contrib/mw-to-git/Git/Mediawiki.pm
index 917d9e2d32..ff7811225e 100644
--- a/contrib/mw-to-git/Git/Mediawiki.pm
+++ b/contrib/mw-to-git/Git/Mediawiki.pm
@@ -1,6 +1,6 @@
 package Git::Mediawiki;
 
-use 5.008;
+use 5.008001;
 use strict;
 use POSIX;
 use Git;
diff --git a/git-archimport.perl b/git-archimport.perl
index b7c173c345..f5a317b899 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -54,7 +54,7 @@ =head1 Devel Notes
 
 =cut
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use Getopt::Std;
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 289d4bc684..1e03ba94d1 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use Getopt::Std;
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 7bf3c12d67..07ea3443f7 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -13,7 +13,7 @@
 # The head revision is on branch "origin" by default.
 # You can change that with the '-o' option.
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use Getopt::Long;
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 7b757360e2..124f598bdc 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -15,7 +15,7 @@
 ####
 ####
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use bytes;
diff --git a/git-send-email.perl b/git-send-email.perl
index cacdbd6bb2..d75a4a33dd 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -16,7 +16,7 @@
 #    and second line is the subject of the message.
 #
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use Getopt::Long;
@@ -228,7 +228,7 @@ sub system_or_msg {
 	my @sprintf_args = ($cmd_name ? $cmd_name : $args->[0], $exit_code);
 	if (defined $msg) {
 		# Quiet the 'redundant' warning category, except we
-		# need to support down to Perl 5.8, so we can't do a
+		# need to support down to Perl 5.8.1, so we can't do a
 		# "no warnings 'redundant'", since that category was
 		# introduced in perl 5.22, and asking for it will die
 		# on older perls.
diff --git a/git-svn.perl b/git-svn.perl
index 4e8878f035..b0d0a50984 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # Copyright (C) 2006, Eric Wong <normalperson@yhbt.net>
 # License: GPL v2 or later
-use 5.008;
+use 5.008001;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use strict;
 use vars qw/	$AUTHOR $VERSION
diff --git a/gitweb/INSTALL b/gitweb/INSTALL
index a58e6b3c44..dadc6efa81 100644
--- a/gitweb/INSTALL
+++ b/gitweb/INSTALL
@@ -29,7 +29,7 @@ Requirements
 ------------
 
  - Core git tools
- - Perl 5.8
+ - Perl 5.8.1
  - Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename.
  - web server
 
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e66eb3d9ba..55e7c6567e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -7,7 +7,7 @@
 #
 # This program is licensed under the GPLv2
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 # handle ACL in file access tests
diff --git a/perl/Git.pm b/perl/Git.pm
index 117765dc73..03bf570bf4 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -7,7 +7,7 @@ =head1 NAME
 
 package Git;
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 895e759c57..5454c3a6d2 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -1,5 +1,5 @@
 package Git::I18N;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 BEGIN {
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 0c360bc799..8c7fa805f9 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -1,5 +1,5 @@
 package Git::LoadCPAN;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 
diff --git a/perl/Git/LoadCPAN/Error.pm b/perl/Git/LoadCPAN/Error.pm
index 5d84c20288..5cecb0fcd6 100644
--- a/perl/Git/LoadCPAN/Error.pm
+++ b/perl/Git/LoadCPAN/Error.pm
@@ -1,5 +1,5 @@
 package Git::LoadCPAN::Error;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use Git::LoadCPAN (
diff --git a/perl/Git/LoadCPAN/Mail/Address.pm b/perl/Git/LoadCPAN/Mail/Address.pm
index 340e88a7a5..9f808090a6 100644
--- a/perl/Git/LoadCPAN/Mail/Address.pm
+++ b/perl/Git/LoadCPAN/Mail/Address.pm
@@ -1,5 +1,5 @@
 package Git::LoadCPAN::Mail::Address;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use Git::LoadCPAN (
diff --git a/perl/Git/Packet.pm b/perl/Git/Packet.pm
index d144f5168f..d896e69523 100644
--- a/perl/Git/Packet.pm
+++ b/perl/Git/Packet.pm
@@ -1,5 +1,5 @@
 package Git::Packet;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 BEGIN {
diff --git a/t/t0202/test.pl b/t/t0202/test.pl
index 2cbf7b9590..47d96a2a13 100755
--- a/t/t0202/test.pl
+++ b/t/t0202/test.pl
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-use 5.008;
+use 5.008001;
 use lib (split(/:/, $ENV{GITPERLLIB}));
 use strict;
 use warnings;
diff --git a/t/t5562/invoke-with-content-length.pl b/t/t5562/invoke-with-content-length.pl
index 718dd9b49d..9babb9a375 100644
--- a/t/t5562/invoke-with-content-length.pl
+++ b/t/t5562/invoke-with-content-length.pl
@@ -1,4 +1,4 @@
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 6d753708d2..d8e85482ab 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use lib (split(/:/, $ENV{GITPERLLIB}));
 
-use 5.008;
+use 5.008001;
 use warnings;
 use strict;
 
diff --git a/t/test-terminal.perl b/t/test-terminal.perl
index 1bcf01a9a4..3810e9bb43 100755
--- a/t/test-terminal.perl
+++ b/t/test-terminal.perl
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use IO::Pty;
-- 
2.43.0.rc2



^ permalink raw reply related	[relevance 52%]

* [RFC PATCH] send-email: allow fixing the cover letter subject
@ 2021-08-24 11:41 52% Carlo Marcelo Arenas Belón
  0 siblings, 0 replies; 200+ results
From: Carlo Marcelo Arenas Belón @ 2021-08-24 11:41 UTC (permalink / raw)
  To: git; +Cc: tr, mhaeuser, Carlo Marcelo Arenas Belón

a03bc5b6ad (send-email: Refuse to send cover-letter template
subject, 2009-06-08) fixes a common problem with the direct use
of `git send-email` to send topics, where the cover letter will
be a template by accident.

Allow using --subject to fix the --cover-letter subject and skip
the safety check without having to use --force.

Note that the use of --compose is also allowed, and will also
get its Subject set through the commandline, but it might make
more sense to instead make them incompatible and force editing
the cover letter instead, hence why sending this only as a RFC.

patch is based on another one[1] still in fly, and the documentation
change is long overdue, but probably should need a better
explanation; lastly using a non ASCII subject also needs fixing,
but it also affects compose, so was left out for now.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>

[1] https://lore.kernel.org/git/4db7759c-2123-533b-9f89-954c07f5832a@posteo.de/
---
 Documentation/git-send-email.txt |  3 +--
 git-send-email.perl              |  8 ++++++--
 t/t9001-send-email.sh            | 16 +++++++++++++++-
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3db4eab4ba..9d2bfa6095 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -113,8 +113,7 @@ is not set, this will be prompted for.
 
 --subject=<string>::
 	Specify the initial subject of the email thread.
-	Only necessary if --compose is also set.  If --compose
-	is not set, this will be prompted for.
+	Only necessary if --compose or --cover-letter are also set.
 
 --to=<address>,...::
 	Specify the primary recipient of the emails generated. Generally, this
diff --git a/git-send-email.perl b/git-send-email.perl
index fd79849530..a33328a5d9 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -997,7 +997,7 @@ sub file_declares_8bit_cte {
 				  default => "UTF-8");
 }
 
-if (!$force) {
+if (!$force and not defined $initial_subject) {
 	for my $f (@files) {
 		if (get_patch_subject($f) =~ /\Q*** SUBJECT HERE ***\E/) {
 			die sprintf(__("Refusing to send because the patch\n\t%s\n"
@@ -1719,7 +1719,6 @@ sub process_file {
 	@xh = ();
 	my $input_format = undef;
 	my @header = ();
-	$subject = $initial_subject;
 	$message = "";
 	$message_num++;
 	# First unfold multiline header fields
@@ -1747,6 +1746,11 @@ sub process_file {
 		if (defined $input_format && $input_format eq 'mbox') {
 			if (/^Subject:\s+(.*)$/i) {
 				$subject = $1;
+
+				if (defined $initial_subject &&
+				$subject =~ /\Q*** SUBJECT HERE ***\E/) {
+					$subject = $initial_subject;
+				}
 			}
 			elsif (/^From:\s+(.*)$/i) {
 				($author, $author_encoding) = unquote_rfc2047($1);
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 747872d5be..043532fe85 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1728,7 +1728,6 @@ test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=base64' '
 	test_cmp expected actual
 '
 
-
 # Note that the patches in this test are deliberately out of order; we
 # want to make sure it works even if the cover-letter is not in the
 # first mail.
@@ -1765,6 +1764,21 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '
 	test -n "$(ls msgtxt*)"
 '
 
+test_expect_success $PREREQ '--subject can be used to fix the cover letter' '
+	clean_fake_sendmail &&
+	git send-email \
+		--cover-letter -2 \
+		--subject="foo" \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		2>errors >out &&
+	! grep "SUBJECT HERE" errors &&
+	ls msgtxt* >list &&
+	test_line_count = 3 list &&
+	grep "Subject: foo" msgtxt1
+'
+
 test_cover_addresses () {
 	header="$1"
 	shift
-- 
2.33.0.481.g26d3bed244


^ permalink raw reply related	[relevance 52%]

* [PATCH v2 1/2] Expose header information to git-send-email's sendemail-validate hook
  @ 2022-11-11 19:30 52% ` Strawbridge, Michael
  0 siblings, 0 replies; 200+ results
From: Strawbridge, Michael @ 2022-11-11 19:30 UTC (permalink / raw)
  To: git@vger.kernel.org
  Cc: Strawbridge, Michael, Tuikov, Luben, brian m . carlson

To allow further flexibility in the git hook, the smtp header
information of the email that git-send-email intends to send, is now
passed as a 2nd argument to the sendemail-validate hook.

As an example, this can be useful for acting upon keywords in the
subject or specific email addresses.

Cc: Luben Tuikov <luben.tuikov@amd.com>
Cc: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Michael Strawbridge <michael.strawbridge@amd.com>
---
 git-send-email.perl | 57 +++++++++++++++++++++++++++++----------------
 1 file changed, 37 insertions(+), 20 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 5861e99a6e..3ce5b1aad3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -787,14 +787,6 @@ sub is_format_patch_arg {
 
 @files = handle_backup_files(@files);
 
-if ($validate) {
-	foreach my $f (@files) {
-		unless (-p $f) {
-			validate_patch($f, $target_xfer_encoding);
-		}
-	}
-}
-
 if (@files) {
 	unless ($quiet) {
 		print $_,"\n" for (@files);
@@ -1495,16 +1487,7 @@ sub file_name_is_absolute {
 	return File::Spec::Functions::file_name_is_absolute($path);
 }
 
-# Prepares the email, then asks the user what to do.
-#
-# If the user chooses to send the email, it's sent and 1 is returned.
-# If the user chooses not to send the email, 0 is returned.
-# If the user decides they want to make further edits, -1 is returned and the
-# caller is expected to call send_message again after the edits are performed.
-#
-# If an error occurs sending the email, this just dies.
-
-sub send_message {
+sub gen_header {
 	my @recipients = unique_email_list(@to);
 	@cc = (grep { my $cc = extract_valid_address_or_die($_);
 		      not grep { $cc eq $_ || $_ =~ /<\Q${cc}\E>$/ } @recipients
@@ -1546,6 +1529,22 @@ sub send_message {
 	if (@xh) {
 		$header .= join("\n", @xh) . "\n";
 	}
+	return $header;
+}
+
+# Prepares the email, then asks the user what to do.
+#
+# If the user chooses to send the email, it's sent and 1 is returned.
+# If the user chooses not to send the email, 0 is returned.
+# If the user decides they want to make further edits, -1 is returned and the
+# caller is expected to call send_message again after the edits are performed.
+#
+# If an error occurs sending the email, this just dies.
+
+sub send_message {
+	my @recipients = unique_email_list(@to);
+
+        my $header = gen_header();
 
 	my @sendmail_parameters = ('-i', @recipients);
 	my $raw_from = $sender;
@@ -1955,6 +1954,15 @@ sub process_file {
 		}
 	}
 
+
+	if ($validate) {
+		foreach my $f (@files) {
+			unless (-p $f) {
+				validate_patch($f, $target_xfer_encoding);
+			}
+		}
+	}
+
 	my $message_was_sent = send_message();
 	if ($message_was_sent == -1) {
 		do_edit($t);
@@ -2088,11 +2096,20 @@ sub validate_patch {
 			chdir($repo->wc_path() or $repo->repo_path())
 				or die("chdir: $!");
 			local $ENV{"GIT_DIR"} = $repo->repo_path();
+
+			my $header = gen_header();
+
+			require File::Temp;
+			my ($header_filehandle, $header_filename) = File::Temp::tempfile(
+                            ".gitsendemail.header.XXXXXX", DIR => $repo->repo_path());
+			print $header_filehandle $header;
+
 			my @cmd = ("git", "hook", "run", "--ignore-missing",
 				    $hook_name, "--");
-			my @cmd_msg = (@cmd, "<patch>");
-			my @cmd_run = (@cmd, $target);
+			my @cmd_msg = (@cmd, "<patch>", "<header>");
+			my @cmd_run = (@cmd, $target, $header_filename);
 			$hook_error = system_or_msg(\@cmd_run, undef, "@cmd_msg");
+			unlink($header_filehandle);
 			chdir($cwd_save) or die("chdir: $!");
 		}
 		if ($hook_error) {
-- 
2.34.1

^ permalink raw reply related	[relevance 52%]

* [PATCHv2] send-email: Ask if a patch should be sent twice
@ 2019-07-30 16:26 52% Dmitry Safonov
  0 siblings, 0 replies; 200+ results
From: Dmitry Safonov @ 2019-07-30 16:26 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Dmitry Safonov, Dmitry Safonov, Andrei Vagin

I was almost certain that git won't let me send the same patch twice,
but today I've managed to double-send a directory by a mistake:
	git send-email --to linux-kernel@vger.kernel.org /tmp/timens/
	    --cc 'Dmitry Safonov <0x7f454c46@gmail.com>' /tmp/timens/`

[I haven't noticed that I put the directory twice ^^]

Prevent this shipwreck from happening again by asking if a patch
is sent multiple times on purpose.

link: https://lkml.kernel.org/r/4d53ebc7-d5b2-346e-c383-606401d19d3a@gmail.com
Cc: Andrei Vagin <avagin@openvz.org>
Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
v2: Moved the check under --validate,
    fixed tests,
    added a new test,
    updated documentation for --validate
 Documentation/git-send-email.txt |  2 ++
 git-send-email.perl              | 14 ++++++++++++++
 t/t9001-send-email.sh            | 15 +++++++++++++++
 3 files changed, 31 insertions(+)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index d93e5d0f58f0..0441bb1b5d3b 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -421,6 +421,8 @@ have been specified, in which case default to 'compose'.
 			('auto', 'base64', or 'quoted-printable') is used;
 			this is due to SMTP limits as described by
 			http://www.ietf.org/rfc/rfc5322.txt.
+		*	Ask confirmation before sending patches multiple times
+			if the supplied patches set overlaps.
 --
 +
 Default is the value of `sendemail.validate`; if this is not set,
diff --git a/git-send-email.perl b/git-send-email.perl
index 5f92c89c1c1b..c1638d06f81d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -688,6 +688,9 @@ sub is_format_patch_arg {
 @files = handle_backup_files(@files);
 
 if ($validate) {
+	my %seen;
+	my @dupes = grep { $seen{$_}++ } @files;
+
 	foreach my $f (@files) {
 		unless (-p $f) {
 			my $error = validate_patch($f, $target_xfer_encoding);
@@ -695,6 +698,17 @@ sub is_format_patch_arg {
 						  $f, $error);
 		}
 	}
+	if (@dupes) {
+		printf(__("Patches specified several times: \n"));
+		printf(__("%s \n" x @dupes), @dupes);
+		$_ = ask(__("Do you want to send those patches several times? Y/n "),
+			default => "y",
+			valid_re => qr/^(?:yes|y|no|n)/i);
+		if (/^n/i) {
+			cleanup_compose_files();
+			exit(0);
+		}
+	}
 }
 
 if (@files) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 997f90b42b3e..77df51519d6e 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -555,6 +555,7 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
 		--no-chain-reply-to \
 		--in-reply-to="$(cat expect)" \
 		--smtp-server="$(pwd)/fake.sendmail" \
+		--no-validate \
 		$patches $patches $patches \
 		2>errors &&
 	# The first message is a reply to --in-reply-to
@@ -577,6 +578,7 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
 		--chain-reply-to \
 		--in-reply-to="$(cat expect)" \
 		--smtp-server="$(pwd)/fake.sendmail" \
+		--no-validate \
 		$patches $patches $patches \
 		2>errors &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
@@ -589,6 +591,19 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
 	test_cmp expect actual
 '
 
+test_expect_success $PREREQ 'ask confirmation for double-send' '
+	clean_fake_sendmail &&
+	echo y | \
+		GIT_SEND_EMAIL_NOTTY=1 \
+		git send-email --from=author@example.com \
+			--to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--validate \
+			$patches $patches $patches \
+			>stdout &&
+	! grep "Patches specified several times: " stdout
+'
+
 test_expect_success $PREREQ 'setup fake editor' '
 	write_script fake-editor <<-\EOF
 	echo fake edit >>"$1"
-- 
2.22.0


^ permalink raw reply related	[relevance 52%]

* [PATCH 1/2] Expose header information to git-send-email's sendemail-validate hook
  @ 2022-11-11  2:15 52% ` Strawbridge, Michael
  0 siblings, 0 replies; 200+ results
From: Strawbridge, Michael @ 2022-11-11  2:15 UTC (permalink / raw)
  To: git@vger.kernel.org
  Cc: Strawbridge, Michael, Tuikov, Luben, brian m . carlson

To allow further flexibility in the git hook, the smtp header
information of the email that git-send-email intends to send, is now
passed as a 2nd argument to the sendemail-validate hook.

As an example, this can be useful for acting upon keywords in the
subject or specific email addresses.

Cc: Luben Tuikov <luben.tuikov@amd.com>
Cc: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Michael Strawbridge <michael.strawbridge@amd.com>
---
 git-send-email.perl | 57 +++++++++++++++++++++++++++++----------------
 1 file changed, 37 insertions(+), 20 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 5861e99a6e..3ce5b1aad3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -787,14 +787,6 @@ sub is_format_patch_arg {
 
 @files = handle_backup_files(@files);
 
-if ($validate) {
-	foreach my $f (@files) {
-		unless (-p $f) {
-			validate_patch($f, $target_xfer_encoding);
-		}
-	}
-}
-
 if (@files) {
 	unless ($quiet) {
 		print $_,"\n" for (@files);
@@ -1495,16 +1487,7 @@ sub file_name_is_absolute {
 	return File::Spec::Functions::file_name_is_absolute($path);
 }
 
-# Prepares the email, then asks the user what to do.
-#
-# If the user chooses to send the email, it's sent and 1 is returned.
-# If the user chooses not to send the email, 0 is returned.
-# If the user decides they want to make further edits, -1 is returned and the
-# caller is expected to call send_message again after the edits are performed.
-#
-# If an error occurs sending the email, this just dies.
-
-sub send_message {
+sub gen_header {
 	my @recipients = unique_email_list(@to);
 	@cc = (grep { my $cc = extract_valid_address_or_die($_);
 		      not grep { $cc eq $_ || $_ =~ /<\Q${cc}\E>$/ } @recipients
@@ -1546,6 +1529,22 @@ sub send_message {
 	if (@xh) {
 		$header .= join("\n", @xh) . "\n";
 	}
+	return $header;
+}
+
+# Prepares the email, then asks the user what to do.
+#
+# If the user chooses to send the email, it's sent and 1 is returned.
+# If the user chooses not to send the email, 0 is returned.
+# If the user decides they want to make further edits, -1 is returned and the
+# caller is expected to call send_message again after the edits are performed.
+#
+# If an error occurs sending the email, this just dies.
+
+sub send_message {
+	my @recipients = unique_email_list(@to);
+
+        my $header = gen_header();
 
 	my @sendmail_parameters = ('-i', @recipients);
 	my $raw_from = $sender;
@@ -1955,6 +1954,15 @@ sub process_file {
 		}
 	}
 
+
+	if ($validate) {
+		foreach my $f (@files) {
+			unless (-p $f) {
+				validate_patch($f, $target_xfer_encoding);
+			}
+		}
+	}
+
 	my $message_was_sent = send_message();
 	if ($message_was_sent == -1) {
 		do_edit($t);
@@ -2088,11 +2096,20 @@ sub validate_patch {
 			chdir($repo->wc_path() or $repo->repo_path())
 				or die("chdir: $!");
 			local $ENV{"GIT_DIR"} = $repo->repo_path();
+
+			my $header = gen_header();
+
+			require File::Temp;
+			my ($header_filehandle, $header_filename) = File::Temp::tempfile(
+                            ".gitsendemail.header.XXXXXX", DIR => $repo->repo_path());
+			print $header_filehandle $header;
+
 			my @cmd = ("git", "hook", "run", "--ignore-missing",
 				    $hook_name, "--");
-			my @cmd_msg = (@cmd, "<patch>");
-			my @cmd_run = (@cmd, $target);
+			my @cmd_msg = (@cmd, "<patch>", "<header>");
+			my @cmd_run = (@cmd, $target, $header_filename);
 			$hook_error = system_or_msg(\@cmd_run, undef, "@cmd_msg");
+			unlink($header_filehandle);
 			chdir($cwd_save) or die("chdir: $!");
 		}
 		if ($hook_error) {
-- 
2.34.1

^ permalink raw reply related	[relevance 52%]

* [PATCH 2/5] git send-email: interpret unknown files as revision lists
  @ 2008-11-04 16:24 52%     ` Pierre Habouzit
  0 siblings, 0 replies; 200+ results
From: Pierre Habouzit @ 2008-11-04 16:24 UTC (permalink / raw)
  To: git; +Cc: Pierre Habouzit

Filter out all the arguments git-send-email doesn't like to a
git format-patch command, that dumps its content to a safe directory.

Barf when a file/revision conflict occurs.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
 Documentation/git-send-email.txt |    2 +-
 git-send-email.perl              |   28 ++++++++++++++++++++++++----
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 82f5056..4654d4f 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -8,7 +8,7 @@ git-send-email - Send a collection of patches as emails
 
 SYNOPSIS
 --------
-'git send-email' [options] <file|directory> [... file|directory]
+'git send-email' [options] <file|directory|rev-list options>...
 
 
 DESCRIPTION
diff --git a/git-send-email.perl b/git-send-email.perl
index aaace02..c29868a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -22,8 +22,11 @@ use Term::ReadLine;
 use Getopt::Long;
 use Data::Dumper;
 use Term::ANSIColor;
+use File::Temp qw/ tempdir /;
 use Git;
 
+Getopt::Long::Configure qw/ pass_through /;
+
 package FakeTerm;
 sub new {
 	my ($class, $reason) = @_;
@@ -38,7 +41,7 @@ package main;
 
 sub usage {
 	print <<EOT;
-git send-email [options] <file | directory>...
+git send-email [options] <file | directory | rev-list options >
 
   Composing:
     --from                  <str>  * Email From:
@@ -363,10 +366,22 @@ if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) {
 
 ($sender) = expand_aliases($sender) if defined $sender;
 
+sub check_file_rev_conflict($) {
+	my $f = shift;
+	if ($repo->command('rev-parse', '--verify', '--quiet', $f)) {
+		die("revision/filename conflict on `$f'");
+	}
+}
+
 # Now that all the defaults are set, process the rest of the command line
 # arguments and collect up the files that need to be processed.
-for my $f (@ARGV) {
-	if (-d $f) {
+my @rev_list_opts;
+while (my $f = pop @ARGV) {
+	if ($f eq "--") {
+		push @rev_list_opts, "--", @ARGV;
+		@ARGV = ();
+	} elsif (-d $f) {
+		check_file_rev_conflict($f);
 		opendir(DH,$f)
 			or die "Failed to opendir $f: $!";
 
@@ -374,12 +389,17 @@ for my $f (@ARGV) {
 				sort readdir(DH);
 		closedir(DH);
 	} elsif (-f $f or -p $f) {
+		check_file_rev_conflict($f);
 		push @files, $f;
 	} else {
-		print STDERR "Skipping $f - not found.\n";
+		push @rev_list_opts, $f;
 	}
 }
 
+if (@rev_list_opts) {
+	push @files, $repo->command('format-patch', '-o', tempdir(CLEANUP => 1), @rev_list_opts);
+}
+
 if ($validate) {
 	foreach my $f (@files) {
 		unless (-p $f) {
-- 
1.5.6.5

^ permalink raw reply related	[relevance 52%]

* [PATCH 2/2] New send-email option smtpserveroptions.
  @ 2010-09-04 16:06 52% ` Pascal Obry
  0 siblings, 0 replies; 200+ results
From: Pascal Obry @ 2010-09-04 16:06 UTC (permalink / raw)
  To: git; +Cc: Pascal Obry

The new command line parameter --smtp-server-options or default
configuration sendemail.smtpserveroptions can be used to pass
specific options to the SMTP server.
---
 Documentation/git-send-email.txt |    5 +++++
 git-send-email.perl              |    9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index c283084..425b102 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -157,6 +157,11 @@ user is prompted for a password while the input is masked for privacy.
 	`/usr/lib/sendmail` if such program is available, or
 	`localhost` otherwise.
 
+--smtp-server-options=<options>::
+	If set, specifies the outgoing SMTP server options to use.
+	Default value can be specified by the 'sendemail.smtpserveroptions'
+	configuration option.
+
 --smtp-server-port=<port>::
 	Specifies a port different from the default port (SMTP
 	servers typically listen to smtp port 25, but may also listen to
diff --git a/git-send-email.perl b/git-send-email.perl
index 0063606..e5cdda7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -60,6 +60,7 @@ git send-email [options] <file | directory | rev-list options >
     --envelope-sender       <str>  * Email envelope sender.
     --smtp-server       <str:int>  * Outgoing SMTP server to use. The port
                                      is optional. Default 'localhost'.
+    --smtp-server-options   <int>  * Outgoing SMTP server options to use.
     --smtp-server-port      <int>  * Outgoing SMTP server port.
     --smtp-user             <str>  * Username for SMTP-AUTH.
     --smtp-pass             <str>  * Password for SMTP-AUTH; not necessary.
@@ -188,7 +189,8 @@ sub do_edit {
 
 # Variables with corresponding config settings
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
-my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
+my ($smtp_server, $smtp_server_port, $smtp_server_options);
+my ($smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts, $smtp_domain);
 my ($validate, $confirm);
 my (@suppress_cc);
@@ -210,6 +212,7 @@ my %config_bool_settings = (
 my %config_settings = (
     "smtpserver" => \$smtp_server,
     "smtpserverport" => \$smtp_server_port,
+    "smtpserveroptions" => \$smtp_server_options,
     "smtpuser" => \$smtp_authuser,
     "smtppass" => \$smtp_authpass,
     "smtpdomain" => \$smtp_domain,
@@ -279,6 +282,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "no-bcc" => \$no_bcc,
 		    "chain-reply-to!" => \$chain_reply_to,
 		    "smtp-server=s" => \$smtp_server,
+		    "smtp-server-options=s" => \$smtp_server_options,
 		    "smtp-server-port=s" => \$smtp_server_port,
 		    "smtp-user=s" => \$smtp_authuser,
 		    "smtp-pass:s" => \$smtp_authpass,
@@ -1015,6 +1019,9 @@ X-Mailer: git-send-email $gitversion
 		}
 	}
 
+	unshift (@sendmail_parameters, $smtp_server_options)
+	    if (defined $smtp_server_options);
+
 	if ($dry_run) {
 		# We don't want to send the email.
 	} elsif ($smtp_server =~ m#^/#) {
-- 
1.7.2.2.277.gb49c4

^ permalink raw reply related	[relevance 52%]

* [PATCH v2] send-email: auth plain/login fix
  @ 2011-09-27 21:36 52% ` Zbigniew Jędrzejewski-Szmek
  2011-09-28 10:26 51% ` [PATCH v3] " Zbigniew Jędrzejewski-Szmek
  1 sibling, 0 replies; 200+ results
From: Zbigniew Jędrzejewski-Szmek @ 2011-09-27 21:36 UTC (permalink / raw)
  To: gitster, joe, git; +Cc: Zbigniew Jędrzejewski-Szmek

git send-email was not authenticating properly when communicating over
TLS with a server supporting only AUTH PLAIN and AUTH LOGIN. This is
e.g. the standard server setup under debian with exim4 and probably
everywhere where system accounts are used.

The solution comes from this forum thread:
http://www.perlmonks.org/?node_id=904354

This patch is tested by sending it :)

Before:
Net::SMTP>>> Net::SMTP(2.31)
Net::SMTP>>>   Net::Cmd(2.29)
Net::SMTP>>>     Exporter(5.64_01)
Net::SMTP>>>   IO::Socket::INET(1.31)
Net::SMTP>>>     IO::Socket(1.31)
Net::SMTP>>>       IO::Handle(1.28)
...
Net::SMTP=GLOB(0x238f668)>>> STARTTLS
Net::SMTP=GLOB(0x238f668)<<< 220 2.0.0 Ready to start TLS
Net::SMTP::SSL=GLOB(0x238f668)>>> EHLO localhost.localdomain
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-yyy.yyy.yyy Hello xxx.xxx [xxx.xxx.xxx.xxx], pleased to meet you
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-PIPELINING
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-8BITMIME
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-SIZE 80000000
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-DSN
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-AUTH=LOGIN PLAIN
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-AUTH LOGIN PLAIN
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-DELIVERBY
Net::SMTP::SSL=GLOB(0x238f668)<<< 250 HELP
Password:
Net::SMTP::SSL=GLOB(0x238f668)>>> AUTH
Net::SMTP::SSL=GLOB(0x238f668)<<< 501 5.5.2 AUTH mechanism must be specified
5.5.2 AUTH mechanism must be specified

After:
Net::SMTP=GLOB(0x1ac4a60)>>> STARTTLS
Net::SMTP=GLOB(0x1ac4a60)<<< 220 2.0.0 Ready to start TLS
Net::SMTP::SSL=GLOB(0x1ac4a60)>>> EHLO localhost.localdomain
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-yyy.yyy.yyy Hello xxx.xxx [xxx.xxx.xxx.xxx], pleased to meet you
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-PIPELINING
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-8BITMIME
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-SIZE 80000000
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-DSN
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-AUTH=LOGIN PLAIN
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-AUTH LOGIN PLAIN
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250-DELIVERBY
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 250 HELP
Password:
Net::SMTP::SSL=GLOB(0x1ac4a60)>>> AUTH LOGIN
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 334 VXNlcm5hbWU6
Net::SMTP::SSL=GLOB(0x1ac4a60)>>> emJ5c3plaw==
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 334 UGFzc3dvcmQ6
Net::SMTP::SSL=GLOB(0x1ac4a60)>>> dGVzdA==
Net::SMTP::SSL=GLOB(0x1ac4a60)<<< 535 5.7.0 authentication failed
5.7.0 authentication failed

The password is incorrect in this snippet, but the protocol works correctly.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 v2: - added sign-off as requested, although the patch is as trivial
       as it gets
     - the import is performed only if it will be used

 git-send-email.perl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 37dfbe7..5a22d18 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1098,6 +1098,8 @@ X-Mailer: git-send-email $gitversion
 		}
 
 		if (defined $smtp_authuser) {
+			require Authen::SASL;
+			Authen::SASL->import(qw(Perl));
 
 			if (!defined $smtp_authpass) {
 
-- 
1.7.6

^ permalink raw reply related	[relevance 52%]

* [PATCH 5/6] send-email: fix threaded mails without chain-reply-to
  @ 2009-06-12 10:51 52% ` Markus Heidelberg
  2009-06-12 10:51 51% ` [PATCH 2/6] send-email: fix non-threaded mails Markus Heidelberg
  1 sibling, 0 replies; 200+ results
From: Markus Heidelberg @ 2009-06-12 10:51 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Michael Witten, Thomas Rast, Markus Heidelberg,
	Junio C Hamano

An earlier commit 15da108 ("send-email: 'References:' should only
reference what is sent", 2009-04-13) broke logic to set up threading
information for the next message by rewriting "!" to "not" without
understanding the precedence rules of the language.

Namely,

    ! defined $reply_to || length($reply_to) == 0

was changed to

    not defined $reply_to || length($reply_to) == 0

which is

    not (defined $reply_to || length($reply_to) == 0)

and different from what was intended, which is

    (not defined $reply_to) || (length($reply_to) == 0)

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * Applies on top of [4/6]

 git-send-email.perl   |    3 ++-
 t/t9001-send-email.sh |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 4c795a4..16d12e0 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1150,7 +1150,8 @@ foreach my $t (@files) {
 	my $message_was_sent = send_message();
 
 	# set up for the next message
-	if ($message_was_sent and $chain_reply_to || not defined $reply_to || length($reply_to) == 0) {
+	if ($message_was_sent &&
+		($chain_reply_to || !defined $reply_to || length($reply_to) == 0)) {
 		$reply_to = $message_id;
 		if (length $references > 0) {
 			$references .= "\n $message_id";
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 4f67de3..8ab1a78 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -621,7 +621,7 @@ test_expect_success 'in-reply-to but no threading' '
 	grep "In-Reply-To: <in-reply-id@example.com>"
 '
 
-test_expect_failure 'threading but no chain-reply-to' '
+test_expect_success 'threading but no chain-reply-to' '
 	git send-email \
 		--dry-run \
 		--from="Example <nobody@example.com>" \
-- 
1.6.3.2.236.ge505d

^ permalink raw reply related	[relevance 52%]

* [PATCH v3] send-email: Add simple email aliases format
@ 2015-05-22  3:35 52% Allen Hubbe
  0 siblings, 0 replies; 200+ results
From: Allen Hubbe @ 2015-05-22  3:35 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Eric Sunshine, Jeff King, Felipe Contreras,
	Allen Hubbe

This format is more simple than the other alias file formats, so it may
be preferred by some users.  The format is as follows.

	<alias>: <address|alias>[, <address|alias>...]

Aliases are specified one per line.  There is no line splitting.
Anything on a line after and including a `#` symbol is considered a
comment, and is ignored.  Blank lines are ignored.

Example of the 'simple' format:

	alice: Alice W Land <awol@example.com>
	bob: Robert Bobbyton <bob@example.com>
	# this is a comment
	   # this is also a comment
	chloe: chloe@example.com
	abgroup: alice, bob # comment after an alias
	bcgrp: bob, chloe, Other <o@example.com>

Signed-off-by: Allen Hubbe <allenbh@gmail.com>
---

Notes:
    This v3 extends the syntax to allow blank lines, and comments.  The test
    case is extended with comments added to alias file input.
    
    The Documentation/git-send-email.txt is updated with a description of
    the simple format.  A note is added for the other formats, directing
    readers to check the documentation of the email clients for a
    description.

 Documentation/git-send-email.txt |  2 +-
 git-send-email.perl              |  6 +++++-
 t/t9001-send-email.sh            | 24 ++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 804554609def..99583c4f8969 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -383,7 +383,7 @@ sendemail.aliasesFile::
 
 sendemail.aliasFileType::
 	Format of the file(s) specified in sendemail.aliasesFile. Must be
-	one of 'mutt', 'mailrc', 'pine', 'elm', or 'gnus'.
+	one of 'mutt', 'mailrc', 'pine', 'elm', 'gnus', or 'simple'.
 
 sendemail.multiEdit::
 	If true (default), a single editor instance will be spawned to edit
diff --git a/git-send-email.perl b/git-send-email.perl
index e1e9b1460ced..25d72e8db8bf 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -515,7 +515,11 @@ my %parse_alias = (
 			       $aliases{$alias} = [ split_addrs($addr) ];
 			  }
 		      } },
-
+	simple => sub { my $fh = shift; while (<$fh>) {
+		if (/^\s*(\S+)\s*:\s*(.+)$/) {
+			my ($alias, $addr) = ($1, $2);
+			$aliases{$alias} = [ split_addrs($addr) ];
+		}}},
 	gnus => sub { my $fh = shift; while (<$fh>) {
 		if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
 			$aliases{$1} = [ $2 ];
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 7be14a4e37f7..bbb73cdf8bec 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1548,6 +1548,30 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
 		2>errors >out &&
 	grep "^!someone@example\.org!$" commandline1
 '
+test_expect_success $PREREQ 'sendemail.aliasfiletype=simple' '
+	clean_fake_sendmail && rm -fr outdir &&
+	git format-patch -1 -o outdir &&
+	{
+		echo "alice: Alice W Land <awol@example.com>"
+		echo "bob: Robert Bobbyton <bob@example.com>"
+		echo "chloe: chloe@example.com"
+		echo "abgroup: alice, bob"
+		echo "bcgrp: bob, chloe, Other <o@example.com>"
+	} >~/.tmp-email-aliases &&
+	git config --replace-all sendemail.aliasesfile \
+		"$(pwd)/.tmp-email-aliases" &&
+	git config sendemail.aliasfiletype simple &&
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--to=alice --to=bcgrp \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		outdir/0001-*.patch \
+		2>errors >out &&
+	grep "^!awol@example\.com!$" commandline1 &&
+	grep "^!bob@example\.com!$" commandline1 &&
+	grep "^!chloe@example\.com!$" commandline1 &&
+	grep "^!o@example\.com!$" commandline1
+'
 
 do_xmailer_test () {
 	expected=$1 params=$2 &&
-- 
2.3.4

^ permalink raw reply related	[relevance 52%]

* [PATCH] send-email: explicitly disable authentication
@ 2018-10-18 21:15 52% Joshua Watt
  0 siblings, 0 replies; 200+ results
From: Joshua Watt @ 2018-10-18 21:15 UTC (permalink / raw)
  To: git; +Cc: Joshua Watt

It can be necessary to disable SMTP authentication by a mechanism other
than sendemail.smtpuser being undefined. For example, if the user has
sendemail.smtpuser set globally but wants to disable authentication
locally in one repository.

--smtp-auth and sendemail.smtpauth now understand the value 'none' which
means to disable authentication completely, even if an authentication
user is specified.

The value 'none' is lower case to avoid conflicts with any RFC 4422
authentication mechanisms.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 Documentation/git-send-email.txt | 4 +++-
 git-send-email.perl              | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 465a4ecbe..751a4851e 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -190,7 +190,9 @@ $ git send-email --smtp-auth="PLAIN LOGIN GSSAPI" ...
 If at least one of the specified mechanisms matches the ones advertised by the
 SMTP server and if it is supported by the utilized SASL library, the mechanism
 is used for authentication. If neither 'sendemail.smtpAuth' nor `--smtp-auth`
-is specified, all mechanisms supported by the SASL library can be used.
+is specified, all mechanisms supported by the SASL library can be used. The
+special value 'none' maybe specified to completely disable authentication
+independently of `--smtp-user`
 
 --smtp-pass[=<password>]::
 	Password for SMTP-AUTH. The argument is optional: If no
diff --git a/git-send-email.perl b/git-send-email.perl
index 2be5dac33..4a74cd350 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -82,7 +82,8 @@ sub usage {
                                      Pass an empty string to disable certificate
                                      verification.
     --smtp-domain           <str>  * The domain name sent to HELO/EHLO handshake
-    --smtp-auth             <str>  * Space-separated list of allowed AUTH mechanisms.
+    --smtp-auth             <str>  * Space-separated list of allowed AUTH mechanisms, or
+                                     "none" to disable authentication.
                                      This setting forces to use one of the listed mechanisms.
     --smtp-debug            <0|1>  * Disable, enable Net::SMTP debug.
 
@@ -1241,7 +1242,7 @@ sub smtp_host_string {
 # (smtp_user was not specified), and 0 otherwise.
 
 sub smtp_auth_maybe {
-	if (!defined $smtp_authuser || $auth) {
+	if (!defined $smtp_authuser || $auth || $smtp_auth eq "none") {
 		return 1;
 	}
 
-- 
2.17.1


^ permalink raw reply related	[relevance 52%]

* [PATCH] send-email: disable option auto-abbreviation
@ 2022-11-24  2:00 52% Kyle Meyer
  0 siblings, 0 replies; 200+ results
From: Kyle Meyer @ 2022-11-24  2:00 UTC (permalink / raw)
  To: git

send-email supports specifying format-patch options.  However, some
valid format-patch short options trigger an error because Getopt's
default auto-abbreviation is enabled.  For example, with

  git send-email -v 3 @{u}

the -v is consumed as send-email's --validate, and 3 is passed on to
the format-patch call, leading to

  fatal: ambiguous argument '3': unknown revision or path not in the
  working tree.  [...]

Disable Getopt's auto-abbreviation feature so that such options are
properly relayed to format-patch.  With this change, there is some
risk of breaking external scripts that rely on the abbreviation, but
that is hopefully unlikely given that Git does not advertise support
for auto-abbreviation and most subcommands do not support it.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
---
 git-send-email.perl   | 2 +-
 t/t9001-send-email.sh | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 5861e99a6e..1e6d5d7677 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -24,7 +24,7 @@
 use Git;
 use Git::I18N;
 
-Getopt::Long::Configure qw/ pass_through /;
+Getopt::Long::Configure qw/ pass_through no_auto_abbrev /;
 
 package FakeTerm;
 sub new {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 01c74b8b07..c2ebf19ec6 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -2334,6 +2334,12 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' '
 		"$(pwd)/0001-add-main.patch"
 '
 
+test_expect_success $PREREQ 'send-email relays -v 4' '
+	test_when_finished "rm -f out" &&
+	git send-email --dry-run -v 4 -1 >out &&
+	grep "PATCH v4" out
+'
+
 test_expect_success $PREREQ 'test that sendmail config is rejected' '
 	test_config sendmail.program sendmail &&
 	test_must_fail git send-email \

base-commit: e7e5c6f715b2de7bea0d39c7d2ba887335b40aa0
-- 
2.38.1


^ permalink raw reply related	[relevance 52%]

* [PATCH 1/2] git-send-email: introduce compose-encoding
@ 2012-10-03 22:05 52% Krzysztof Mazur
    0 siblings, 1 reply; 200+ results
From: Krzysztof Mazur @ 2012-10-03 22:05 UTC (permalink / raw)
  To: git; +Cc: Krzysztof Mazur

The introduction email (--compose option) have encoding hardcoded to
UTF-8, but invoked editor may not use UTF-8 encoding.
The encoding used by patches can be changed by the "8bit-encoding"
option, but this option does not have effect on introduction email
and equivalent for introduction email is missing.

Added compose-encoding command line option and sendemail.composeencoding
configuration option specify encoding of introduction email.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
---
 Documentation/git-send-email.txt | 5 +++++
 git-send-email.perl              | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3241170..9f09e92 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -126,6 +126,11 @@ The --to option must be repeated for each user you want on the to list.
 +
 Note that no attempts whatsoever are made to validate the encoding.
 
+--compose-encoding=<encoding>::
+	Specify encoding of compose message. Default is the value of the
+	'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
++
+
 
 Sending
 ~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index aea66a0..107e814 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -56,6 +56,7 @@ git send-email [options] <file | directory | rev-list options >
     --in-reply-to           <str>  * Email "In-Reply-To:"
     --annotate                     * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
+    --compose-encoding      <str>  * Encoding to assume for introduction.
     --8bit-encoding         <str>  * Encoding to assume 8bit mails if undeclared
 
   Sending:
@@ -198,6 +199,7 @@ my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
 my ($validate, $confirm);
 my (@suppress_cc);
 my ($auto_8bit_encoding);
+my ($compose_encoding);
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -231,6 +233,7 @@ my %config_settings = (
     "confirm"   => \$confirm,
     "from" => \$sender,
     "assume8bitencoding" => \$auto_8bit_encoding,
+    "composeencoding" => \$compose_encoding,
 );
 
 my %config_path_settings = (
@@ -315,6 +318,7 @@ my $rc = GetOptions("h" => \$help,
 		    "validate!" => \$validate,
 		    "format-patch!" => \$format_patch,
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
+		    "compose-encoding=s" => \$compose_encoding,
 		    "force" => \$force,
 	 );
 
@@ -638,10 +642,13 @@ EOT
 			$summary_empty = 0 unless (/^\n$/);
 		} elsif (/^\n$/) {
 			$in_body = 1;
+			if (!defined $compose_encoding) {
+				$compose_encoding = "UTF-8";
+			}
 			if ($need_8bit_cte) {
 				print $c2 "MIME-Version: 1.0\n",
 					 "Content-Type: text/plain; ",
-					   "charset=UTF-8\n",
+					   "charset=$compose_encoding\n",
 					 "Content-Transfer-Encoding: 8bit\n";
 			}
 		} elsif (/^MIME-Version:/i) {
-- 
1.7.12.2.2.g1c3c581

^ permalink raw reply related	[relevance 52%]

* [RFC][PATCH] send-email: add --[no-]xmailer option
@ 2014-03-24 21:38 52% Luis Henriques
    0 siblings, 1 reply; 200+ results
From: Luis Henriques @ 2014-03-24 21:38 UTC (permalink / raw)
  To: git

Add --[no-]xmailer that allows a user to disable adding the 'X-Mailer:'
header to the email being sent.

Signed-off-by: Luis Henriques <henrix@camandro.org>
---
 Documentation/config.txt         |  1 +
 Documentation/git-send-email.txt |  3 +++
 git-send-email.perl              | 12 ++++++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 73c8973..c33d5a1 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2222,6 +2222,7 @@ sendemail.smtpserveroption::
 sendemail.smtpuser::
 sendemail.thread::
 sendemail.validate::
+sendemail.xmailer::
 	See linkgit:git-send-email[1] for description.
 
 sendemail.signedoffcc::
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index f0e57a5..fab6264 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -131,6 +131,9 @@ Note that no attempts whatsoever are made to validate the encoding.
 	Specify encoding of compose message. Default is the value of the
 	'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
 
+--xmailer::
+	Prevent adding the "X-Mailer:" header.  Default value is
+	'sendemail.xmailer'.
 
 Sending
 ~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index fdb0029..8789124 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -54,6 +54,7 @@ git send-email [options] <file | directory | rev-list options >
     --[no-]bcc              <str>  * Email Bcc:
     --subject               <str>  * Email "Subject:"
     --in-reply-to           <str>  * Email "In-Reply-To:"
+    --[no-]xmailer                 * Don't add "X-Mailer:" header.  Default on.
     --[no-]annotate                * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
     --compose-encoding      <str>  * Encoding to assume for introduction.
@@ -174,6 +175,9 @@ my $force = 0;
 my $multiedit;
 my $editor;
 
+# Usage of X-Mailer email header
+my $xmailer;
+
 sub do_edit {
 	if (!defined($editor)) {
 		$editor = Git::command_oneline('var', 'GIT_EDITOR');
@@ -214,7 +218,8 @@ my %config_bool_settings = (
     "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
     "validate" => [\$validate, 1],
     "multiedit" => [\$multiedit, undef],
-    "annotate" => [\$annotate, undef]
+    "annotate" => [\$annotate, undef],
+    "xmailer" => [\$xmailer, 1]
 );
 
 my %config_settings = (
@@ -311,6 +316,7 @@ my $rc = GetOptions("h" => \$help,
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
 		    "compose-encoding=s" => \$compose_encoding,
 		    "force" => \$force,
+		    "xmailer!" => \$xmailer,
 	 );
 
 usage() if $help;
@@ -1144,8 +1150,10 @@ To: $to${ccline}
 Subject: $subject
 Date: $date
 Message-Id: $message_id
-X-Mailer: git-send-email $gitversion
 ";
+	if ($xmailer) {
+		$header .= "X-Mailer: git-send-email $gitversion\n";
+	}
 	if ($reply_to) {
 
 		$header .= "In-Reply-To: $reply_to\n";
-- 
1.9.1

^ permalink raw reply related	[relevance 52%]

* [PATCH v2] send-email: Add simple email aliases format
@ 2015-05-22  0:16 52% Allen Hubbe
  0 siblings, 0 replies; 200+ results
From: Allen Hubbe @ 2015-05-22  0:16 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Eric Sunshine, Jeff King, Felipe Contreras,
	Allen Hubbe

This format is more simple than the other alias file formats, so it may
be preferred by some users.  The format is as follows.

<alias>: <address|alias>[, <address|alias>...]

Aliases are specified one per line.  There is no line splitting.

Example:
	alice: Alice W Land <awol@example.com>
	bob: Robert Bobbyton <bob@example.com>
	chloe: chloe@example.com
	abgroup: alice, bob
	bcgrp: bob, chloe, Other <o@example.com>

Signed-off-by: Allen Hubbe <allenbh@gmail.com>
---

Notes:
    The v1 of this patch had the following subject line:
    git-send-email.perl: Add sendmail aliases support
    
    This v2 renames this email alias format to simple, because the syntax
    that is actually supported by the parser differs from the format used by
    sendmail.  Now, there is no mention of sendmail in the name of the
    format, the documentation, or the commit message.
    
    This v2 also adds a test case to t/t9001-send-email.sh, and updates the
    list of alias file types in Documentation/git-send-email.txt.

 Documentation/git-send-email.txt |  2 +-
 git-send-email.perl              |  6 +++++-
 t/t9001-send-email.sh            | 24 ++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 804554609def..99583c4f8969 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -383,7 +383,7 @@ sendemail.aliasesFile::
 
 sendemail.aliasFileType::
 	Format of the file(s) specified in sendemail.aliasesFile. Must be
-	one of 'mutt', 'mailrc', 'pine', 'elm', or 'gnus'.
+	one of 'mutt', 'mailrc', 'pine', 'elm', 'gnus', or 'simple'.
 
 sendemail.multiEdit::
 	If true (default), a single editor instance will be spawned to edit
diff --git a/git-send-email.perl b/git-send-email.perl
index e1e9b1460ced..25d72e8db8bf 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -515,7 +515,11 @@ my %parse_alias = (
 			       $aliases{$alias} = [ split_addrs($addr) ];
 			  }
 		      } },
-
+	simple => sub { my $fh = shift; while (<$fh>) {
+		if (/^\s*(\S+)\s*:\s*(.+)$/) {
+			my ($alias, $addr) = ($1, $2);
+			$aliases{$alias} = [ split_addrs($addr) ];
+		}}},
 	gnus => sub { my $fh = shift; while (<$fh>) {
 		if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
 			$aliases{$1} = [ $2 ];
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 7be14a4e37f7..bbb73cdf8bec 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1548,6 +1548,30 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
 		2>errors >out &&
 	grep "^!someone@example\.org!$" commandline1
 '
+test_expect_success $PREREQ 'sendemail.aliasfiletype=simple' '
+	clean_fake_sendmail && rm -fr outdir &&
+	git format-patch -1 -o outdir &&
+	{
+		echo "alice: Alice W Land <awol@example.com>"
+		echo "bob: Robert Bobbyton <bob@example.com>"
+		echo "chloe: chloe@example.com"
+		echo "abgroup: alice, bob"
+		echo "bcgrp: bob, chloe, Other <o@example.com>"
+	} >~/.tmp-email-aliases &&
+	git config --replace-all sendemail.aliasesfile \
+		"$(pwd)/.tmp-email-aliases" &&
+	git config sendemail.aliasfiletype simple &&
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--to=alice --to=bcgrp \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		outdir/0001-*.patch \
+		2>errors >out &&
+	grep "^!awol@example\.com!$" commandline1 &&
+	grep "^!bob@example\.com!$" commandline1 &&
+	grep "^!chloe@example\.com!$" commandline1 &&
+	grep "^!o@example\.com!$" commandline1
+'
 
 do_xmailer_test () {
 	expected=$1 params=$2 &&
-- 
2.3.4

^ permalink raw reply related	[relevance 52%]

* [PATCH v2] send-email: Avoid empty transfer encoding header
  @ 2018-11-02  9:52 52% ` Aaron Lindsay
  0 siblings, 0 replies; 200+ results
From: Aaron Lindsay @ 2018-11-02  9:52 UTC (permalink / raw)
  To: git; +Cc: brian m . carlson, Paolo Bonzini, Junio C Hamano, Aaron Lindsay

Fix a small bug introduced by "7a36987ff (send-email: add an auto option
for transfer encoding, 2018-07-14)"

I saw the following message when setting --transfer-encoding for a file
with the same encoding:
    $ git send-email --transfer-encoding=8bit example.patch
    Use of uninitialized value $xfer_encoding in concatenation (.) or string
    at /usr/lib/git-core/git-send-email line 1744.

v2 adds a test provided by brian m. carlson.

Signed-off-by: Aaron Lindsay <aaron@aclindsay.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 git-send-email.perl   |  2 +-
 t/t9001-send-email.sh | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 2be5dac33..39c15bcc8 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1834,7 +1834,7 @@ sub apply_transfer_encoding {
 	my $from = shift;
 	my $to = shift;
 
-	return $message if ($from eq $to and $from ne '7bit');
+	return ($message, $to) if ($from eq $to and $from ne '7bit');
 
 	require MIME::QuotedPrint;
 	require MIME::Base64;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1ef1a1900..ee1efcc59 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -492,6 +492,21 @@ do
 			--validate \
 			$patches longline.patch
 	'
+
+done
+
+for enc in 7bit 8bit quoted-printable base64
+do
+	test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '
+		clean_fake_sendmail &&
+		git send-email \
+			--from="Example <nobody@example.com>" \
+			--to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--transfer-encoding=$enc \
+			$patches &&
+		grep "Content-Transfer-Encoding: $enc" msgtxt1
+	'
 done
 
 test_expect_success $PREREQ 'Invalid In-Reply-To' '
-- 
2.19.1


^ permalink raw reply related	[relevance 52%]

* [PATCH v3 1/4] send-email: make annotate configurable
  @ 2013-04-07  7:10 52% ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2013-04-07  7:10 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Matthieu Moy, Thomas Rast, Stephen Boyd,
	Daniel Barkalow, Felipe Contreras

Some people always do --annotate, lets not force them to always type
that.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/config.txt         | 1 +
 Documentation/git-send-email.txt | 5 +++--
 git-send-email.perl              | 7 ++++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index bbba728..c8e2178 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1994,6 +1994,7 @@ sendemail.<identity>.*::
 
 sendemail.aliasesfile::
 sendemail.aliasfiletype::
+sendemail.annotate::
 sendemail.bcc::
 sendemail.cc::
 sendemail.cccmd::
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 44a1f7c..2facc18 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -45,8 +45,9 @@ Composing
 ~~~~~~~~~
 
 --annotate::
-	Review and edit each patch you're about to send. See the
-	CONFIGURATION section for 'sendemail.multiedit'.
+	Review and edit each patch you're about to send. Default is the value
+	of 'sendemail.annotate'. See the CONFIGURATION section for
+	'sendemail.multiedit'.
 
 --bcc=<address>::
 	Specify a "Bcc:" value for each email. Default is the value of
diff --git a/git-send-email.perl b/git-send-email.perl
index be809e5..e187b12 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -54,7 +54,7 @@ git send-email [options] <file | directory | rev-list options >
     --[no-]bcc              <str>  * Email Bcc:
     --subject               <str>  * Email "Subject:"
     --in-reply-to           <str>  * Email "In-Reply-To:"
-    --annotate                     * Review each patch that will be sent in an editor.
+    --[no-]annotate                * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
     --compose-encoding      <str>  * Encoding to assume for introduction.
     --8bit-encoding         <str>  * Encoding to assume 8bit mails if undeclared
@@ -212,7 +212,8 @@ my %config_bool_settings = (
     "signedoffbycc" => [\$signed_off_by_cc, undef],
     "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
     "validate" => [\$validate, 1],
-    "multiedit" => [\$multiedit, undef]
+    "multiedit" => [\$multiedit, undef],
+    "annotate" => [\$annotate, undef]
 );
 
 my %config_settings = (
@@ -304,7 +305,7 @@ my $rc = GetOptions("h" => \$help,
 		    "smtp-debug:i" => \$debug_net_smtp,
 		    "smtp-domain:s" => \$smtp_domain,
 		    "identity=s" => \$identity,
-		    "annotate" => \$annotate,
+		    "annotate!" => \$annotate,
 		    "compose" => \$compose,
 		    "quiet" => \$quiet,
 		    "cc-cmd=s" => \$cc_cmd,
-- 
1.8.2

^ permalink raw reply related	[relevance 52%]

* [PATCH v4 1/6] send-email: make annotate configurable
  @ 2013-04-07 17:46 52% ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2013-04-07 17:46 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Matthieu Moy, Thomas Rast, Stephen Boyd,
	Daniel Barkalow, Felipe Contreras

Some people always do --annotate, lets not force them to always type
that.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/config.txt         | 1 +
 Documentation/git-send-email.txt | 5 +++--
 git-send-email.perl              | 7 ++++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index bbba728..c8e2178 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1994,6 +1994,7 @@ sendemail.<identity>.*::
 
 sendemail.aliasesfile::
 sendemail.aliasfiletype::
+sendemail.annotate::
 sendemail.bcc::
 sendemail.cc::
 sendemail.cccmd::
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 44a1f7c..2facc18 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -45,8 +45,9 @@ Composing
 ~~~~~~~~~
 
 --annotate::
-	Review and edit each patch you're about to send. See the
-	CONFIGURATION section for 'sendemail.multiedit'.
+	Review and edit each patch you're about to send. Default is the value
+	of 'sendemail.annotate'. See the CONFIGURATION section for
+	'sendemail.multiedit'.
 
 --bcc=<address>::
 	Specify a "Bcc:" value for each email. Default is the value of
diff --git a/git-send-email.perl b/git-send-email.perl
index be809e5..e187b12 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -54,7 +54,7 @@ git send-email [options] <file | directory | rev-list options >
     --[no-]bcc              <str>  * Email Bcc:
     --subject               <str>  * Email "Subject:"
     --in-reply-to           <str>  * Email "In-Reply-To:"
-    --annotate                     * Review each patch that will be sent in an editor.
+    --[no-]annotate                * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
     --compose-encoding      <str>  * Encoding to assume for introduction.
     --8bit-encoding         <str>  * Encoding to assume 8bit mails if undeclared
@@ -212,7 +212,8 @@ my %config_bool_settings = (
     "signedoffbycc" => [\$signed_off_by_cc, undef],
     "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
     "validate" => [\$validate, 1],
-    "multiedit" => [\$multiedit, undef]
+    "multiedit" => [\$multiedit, undef],
+    "annotate" => [\$annotate, undef]
 );
 
 my %config_settings = (
@@ -304,7 +305,7 @@ my $rc = GetOptions("h" => \$help,
 		    "smtp-debug:i" => \$debug_net_smtp,
 		    "smtp-domain:s" => \$smtp_domain,
 		    "identity=s" => \$identity,
-		    "annotate" => \$annotate,
+		    "annotate!" => \$annotate,
 		    "compose" => \$compose,
 		    "quiet" => \$quiet,
 		    "cc-cmd=s" => \$cc_cmd,
-- 
1.8.2

^ permalink raw reply related	[relevance 52%]

* [PATCH RFC3 13/13] send-email: --compose always includes a 'GIT: ' prefixed list of patch subjects
  @ 2009-04-13 18:23 52%                         ` Michael Witten
  0 siblings, 0 replies; 200+ results
From: Michael Witten @ 2009-04-13 18:23 UTC (permalink / raw)
  To: git

I've found that having a list of the patch subjects appended to
the end of an existing --compose email is quite useful.

I've tried to make appending smart enough not to alter existing
lines beyond the addition of some kind of newline.

Signed-off-by: Michael Witten <mfwitten@gmail.com>
---
 Documentation/git-send-email.txt |    3 ++-
 git-send-email.perl              |   20 ++++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 5ef8b12..6edef52 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -61,7 +61,8 @@ The --cc option must be repeated for each user you want on the cc list.
 	`$GIT_EDITOR`, 'core.editor', `$VISUAL`, `$EDITOR`, or `vi`.
 +
 A path for the composition may be given. If the path exists, then
-the file at the path is opened for editing as-is. If the path
+the file at the path is opened for editing with the list of patch
+subjects (prefixed with 'GIT: ') appended to the end. If the path
 doesn't exist, a file with default content is created at the path
 and opened for editing. If no path is specified, a new temporary
 file with default content is created and opened for editing.
diff --git a/git-send-email.perl b/git-send-email.perl
index 2ab76c6..696b132 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -644,9 +644,25 @@ if (defined $compose) {
 		print "GIT: This is the first line of the <body>:\n";
 		print "\n";
 
-		for my $f (@files) {
-			print get_patch_subject($f);
+		print get_patch_subject($_) for (@files);
+
+	} else {
+
+		# Supply a listing of the patch subjects, in case
+		# it might be useful to the user:
+
+		open $compose_path_filehandle, "+<", $compose_path
+			or die "--compose: Could not open '$compose_path' for appending listing: $!\n";
+
+		# Figure out whether we should begin a new line
+		# (we don't want to append to an existing line):
+
+		if (seek $compose_path_filehandle, -1, 2) {
+			read $compose_path_filehandle, my $c, 1;
+			$c !~ /\n|\r/ and print $compose_path_filehandle "\n";
 		}
+
+		print $compose_path_filehandle get_patch_subject($_) for (@files);
 	}
 
 	# Do the editing:
-- 
1.6.2.2.479.g2aec

^ permalink raw reply related	[relevance 52%]

* [PATCH v2 2/4] send-email: accept long lines with suitable transfer encoding
  @ 2018-07-08 22:17 52%   ` brian m. carlson
  0 siblings, 0 replies; 200+ results
From: brian m. carlson @ 2018-07-08 22:17 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, Junio C Hamano, Drew DeVault, Eric Sunshine

With --validate (which is the default), we warn about lines exceeding
998 characters due to the limits specified in RFC 5322.  However, if
we're using a suitable transfer encoding (quoted-printable or base64),
we're guaranteed not to have lines exceeding 76 characters, so there's
no need to fail in this case.  The auto transfer encoding handles this
specific case, so accept it as well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 Documentation/git-send-email.txt |  7 +++++--
 git-send-email.perl              | 18 +++++++++++-------
 t/t9001-send-email.sh            | 13 +++++++++++++
 3 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 385c7de9e2..0e648075bb 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -401,8 +401,11 @@ have been specified, in which case default to 'compose'.
 +
 --
 		*	Invoke the sendemail-validate hook if present (see linkgit:githooks[5]).
-		*	Warn of patches that contain lines longer than 998 characters; this
-			is due to SMTP limits as described by http://www.ietf.org/rfc/rfc2821.txt.
+		*	Warn of patches that contain lines longer than
+			998 characters unless a suitable transfer encoding
+			('auto', 'base64', or 'quoted-printable') is used;
+			this is due to SMTP limits as described by
+			http://www.ietf.org/rfc/rfc2821.txt.
 --
 +
 Default is the value of `sendemail.validate`; if this is not set,
diff --git a/git-send-email.perl b/git-send-email.perl
index 1736a09d21..e6bcc55827 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -645,7 +645,7 @@ sub is_format_patch_arg {
 if ($validate) {
 	foreach my $f (@files) {
 		unless (-p $f) {
-			my $error = validate_patch($f);
+			my $error = validate_patch($f, $target_xfer_encoding);
 			$error and die sprintf(__("fatal: %s: %s\nwarning: no patches were sent\n"),
 						  $f, $error);
 		}
@@ -1879,7 +1879,7 @@ sub unique_email_list {
 }
 
 sub validate_patch {
-	my $fn = shift;
+	my ($fn, $xfer_encoding) = @_;
 
 	if ($repo) {
 		my $validate_hook = catfile(catdir($repo->repo_path(), 'hooks'),
@@ -1899,11 +1899,15 @@ sub validate_patch {
 		return $hook_error if $hook_error;
 	}
 
-	open(my $fh, '<', $fn)
-		or die sprintf(__("unable to open %s: %s\n"), $fn, $!);
-	while (my $line = <$fh>) {
-		if (length($line) > 998) {
-			return sprintf(__("%s: patch contains a line longer than 998 characters"), $.);
+	# Any long lines will be automatically fixed if we use a suitable transfer
+	# encoding.
+	unless ($xfer_encoding =~ /^(?:auto|quoted-printable|base64)$/) {
+		open(my $fh, '<', $fn)
+			or die sprintf(__("unable to open %s: %s\n"), $fn, $!);
+		while (my $line = <$fh>) {
+			if (length($line) > 998) {
+				return sprintf(__("%s: patch contains a line longer than 998 characters"), $.);
+			}
 		}
 	}
 	return;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index a35cba6a4c..1b474cca28 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -479,6 +479,19 @@ test_expect_success $PREREQ 'long lines with auto encoding are quoted-printable'
 	grep "Content-Transfer-Encoding: quoted-printable" msgtxt1
 '
 
+for enc in auto quoted-printable base64
+do
+	test_expect_success $PREREQ "--validate passes with encoding $enc" '
+		git send-email \
+			--from="Example <nobody@example.com>" \
+			--to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--transfer-encoding=$enc \
+			--validate \
+			$patches longline.patch
+	'
+done
+
 test_expect_success $PREREQ 'Invalid In-Reply-To' '
 	clean_fake_sendmail &&
 	git send-email \

^ permalink raw reply related	[relevance 52%]

* [PATCH 2/2] git-send-email: add --transfer-encoding option
  @ 2014-11-25 14:00 52% ` Paolo Bonzini
  0 siblings, 0 replies; 200+ results
From: Paolo Bonzini @ 2014-11-25 14:00 UTC (permalink / raw)
  To: git; +Cc: lersek, Paolo Bonzini

From: Paolo Bonzini <pbonzini@redhat.com>

The thread at http://thread.gmane.org/gmane.comp.version-control.git/257392
details problems when applying patches with "git am" in a repository with
CRLF line endings.  In the example in the thread, the repository originated
from "git-svn" so it is not possible to use core.eol and friends on it.

Right now, the best option is to use "git am --keep-cr".  However, when
a patch create new files, the patch application process will reject the
new file because it finds a "/dev/null\r" string instead of "/dev/null".

The problem is that SMTP transport is CRLF-unsafe.  Sending a patch by
email is the same as passing it through "dos2unix | unix2dos".  The newly
introduced CRLFs are normally transparent because git-am strips them. The
keepcr=true setting preserves them, but it is mostly working by chance
and it would be very problematic to have a "git am" workflow in a
repository with mixed LF and CRLF line endings.

The MIME solution to this is the quoted-printable transfer enconding.
This is not something that we want to enable by default, since it makes
received emails horrible to look at.  However, it is a very good match
for projects that store CRLF line endings in the repository.

The only disadvantage of quoted-printable is that quoted-printable
patches fail to apply if the maintainer uses "git am --keep-cr".  This
is because the decoded patch will have two carriage returns at the end
of the line.  Therefore, add support for base64 transfer encoding too,
which makes received emails downright impossible to look at outside
a MUA, but really just works.

The patch covers all bases, including users that still live in the late
80s, by also providing a 7bit content transfer encoding that refuses
to send emails with non-ASCII character in them.  And finally, "8bit"
will add a Content-Transfer-Encoding header but otherwise do nothing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Documentation/config.txt               |   1 +
 Documentation/git-send-email.txt       |  10 +++
 contrib/completion/git-completion.bash |   4 +
 git-send-email.perl                    |  36 ++++++++
 t/t9001-send-email.sh                  | 157 +++++++++++++++++++++++++++++++++
 5 files changed, 208 insertions(+)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 9220725..cc2ff20 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2303,6 +2303,7 @@ sendemail.smtpserverport::
 sendemail.smtpserveroption::
 sendemail.smtpuser::
 sendemail.thread::
+sendemail.transferencoding::
 sendemail.validate::
 	See linkgit:git-send-email[1] for description.
 
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index a60776e..a9efa5c 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -131,6 +131,16 @@ Note that no attempts whatsoever are made to validate the encoding.
 	Specify encoding of compose message. Default is the value of the
 	'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
 
+--transfer-encoding=(7bit|8bit|quoted-printable|base64)::
+	Specify the transfer encoding to be used to send the message over SMTP.
+	7bit will fail upon encountering a non-ASCII message.  quoted-printable
+	can be useful when the repository contains files that contain carriage
+	returns, but makes the raw patch email file (as saved from a MUA) much
+	harder to inspect manually.  base64 is even more fool proof, but also
+	even more opaque.  Default is the value of the 'sendemail.transferEncoding'
+	configuration value; if that is unspecified, git will use 8bit and not
+	add a Content-Transfer-Encoding header.
+
 
 Sending
 ~~~~~~~
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 2fece98..b154f70 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1875,6 +1875,10 @@ _git_config ()
 		__gitcomp "$__git_send_email_suppresscc_options"
 		return
 		;;
+	sendemail.transferencoding)
+		__gitcomp "7bit 8bit quoted-printable base64"
+		return
+		;;
 	--get|--get-all|--unset|--unset-all)
 		__gitcomp_nl "$(__git_config_get_set_variables)"
 		return
diff --git a/git-send-email.perl b/git-send-email.perl
index b29a304..82c6fea 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -58,6 +58,7 @@ git send-email [options] <file | directory | rev-list options >
     --compose                      * Open an editor for introduction.
     --compose-encoding      <str>  * Encoding to assume for introduction.
     --8bit-encoding         <str>  * Encoding to assume 8bit mails if undeclared
+    --transfer-encoding     <str>  * Transfer encoding to use (quoted-printable, 8bit, base64)
 
   Sending:
     --envelope-sender       <str>  * Email envelope sender.
@@ -206,6 +207,7 @@ my ($validate, $confirm);
 my (@suppress_cc);
 my ($auto_8bit_encoding);
 my ($compose_encoding);
+my ($target_xfer_encoding);
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -242,6 +244,7 @@ my %config_settings = (
     "from" => \$sender,
     "assume8bitencoding" => \$auto_8bit_encoding,
     "composeencoding" => \$compose_encoding,
+    "transferencoding" => \$target_xfer_encoding,
 );
 
 my %config_path_settings = (
@@ -314,6 +317,7 @@ my $rc = GetOptions("h" => \$help,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
 		    "validate!" => \$validate,
+		    "transfer-encoding=s" => \$target_xfer_encoding,
 		    "format-patch!" => \$format_patch,
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
 		    "compose-encoding=s" => \$compose_encoding,
@@ -1482,6 +1486,12 @@ foreach my $t (@files) {
 			}
 		}
 	}
+	if (defined $target_xfer_encoding) {
+		$xfer_encoding = '8bit' if not defined $xfer_encoding;
+		$message = apply_transfer_encoding(
+			$message, $xfer_encoding, $target_xfer_encoding);
+		$xfer_encoding = $target_xfer_encoding;
+	}
 	if (defined $xfer_encoding) {
 		push @xh, "Content-Transfer-Encoding: $xfer_encoding";
 	}
@@ -1556,6 +1566,32 @@ sub cleanup_compose_files {
 
 $smtp->quit if $smtp;
 
+sub apply_transfer_encoding {
+	my $message = shift;
+	my $from = shift;
+	my $to = shift;
+
+	return $message if ($from eq $to and $from ne '7bit');
+
+	require MIME::QuotedPrint;
+	require MIME::Base64;
+
+	$message = MIME::QuotedPrint::decode($message)
+		if ($from eq 'quoted-printable');
+	$message = MIME::Base64::decode($message)
+		if ($from eq 'base64');
+
+	die "cannot send message as 7bit"
+		if ($to eq '7bit' and $message =~ /[^[:ascii:]]/);
+	return $message
+		if ($to eq '7bit' or $to eq '8bit');
+	return MIME::QuotedPrint::encode($message, "\n", 0)
+		if ($to eq 'quoted-printable');
+	return MIME::Base64::encode($message, "\n")
+		if ($to eq 'base64');
+	die "invalid transfer encoding";
+}
+
 sub unique_email_list {
 	my %seen;
 	my @emails;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 19a3ced..e5016f4 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1298,6 +1298,163 @@ test_expect_success $PREREQ '--8bit-encoding also treats subject' '
 	test_cmp expected actual
 '
 
+test_expect_success $PREREQ 'setup expect' '
+cat >email-using-8bit <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: A U Thor <author@example.com>
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+Content-Type: text/plain; charset=UTF-8
+Subject: Nothing to see here.
+
+Dieser Betreff enthält auch einen Umlaut!
+EOF
+'
+
+test_expect_success $PREREQ 'sendemail.transferencoding=7bit fails on 8bit data' '
+	clean_fake_sendmail &&
+	git config sendemail.transferEncoding 7bit &&
+	test_must_fail git send-email \
+	  --transfer-encoding=7bit \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  email-using-8bit \
+	  2>errors >out &&
+	grep "cannot send message as 7bit" errors &&
+	test -z "$(ls msgtxt*)"
+'
+
+test_expect_success $PREREQ '--transfer-encoding overrides sendemail.transferEncoding' '
+	clean_fake_sendmail &&
+	git config sendemail.transferEncoding 8bit
+	test_must_fail git send-email \
+	  --transfer-encoding=7bit \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  email-using-8bit \
+	  2>errors >out &&
+	grep "cannot send message as 7bit" errors &&
+	test -z "$(ls msgtxt*)"
+'
+
+test_expect_success $PREREQ 'sendemail.transferencoding=8bit' '
+	clean_fake_sendmail &&
+	git send-email \
+	  --transfer-encoding=8bit \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  email-using-8bit \
+	  2>errors >out &&
+	sed '1,/^$/d' msgtxt1 >actual &&
+	sed '1,/^$/d' email-using-8bit >expected &&
+	test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' '
+cat >expected <<EOF
+Dieser Betreff enth=C3=A4lt auch einen Umlaut!
+EOF
+'
+
+test_expect_success $PREREQ '8-bit and sendemail.transferencoding=quoted-printable' '
+	clean_fake_sendmail &&
+	git send-email \
+	  --transfer-encoding=quoted-printable \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  email-using-8bit \
+	  2>errors >out &&
+	sed '1,/^$/d' msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' '
+cat >expected <<EOF
+RGllc2VyIEJldHJlZmYgZW50aMOkbHQgYXVjaCBlaW5lbiBVbWxhdXQhCg==
+EOF
+'
+
+test_expect_success $PREREQ '8-bit and sendemail.transferencoding=base64' '
+	clean_fake_sendmail &&
+	git send-email \
+	  --transfer-encoding=base64 \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  email-using-8bit \
+	  2>errors >out &&
+	sed '1,/^$/d' msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' '
+cat >email-using-qp <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: A U Thor <author@example.com>
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+MIME-Version: 1.0
+Content-Transfer-Encoding: quoted-printable
+Content-Type: text/plain; charset=UTF-8
+Subject: Nothing to see here.
+
+Dieser Betreff enth=C3=A4lt auch einen Umlaut!
+EOF
+'
+
+test_expect_success $PREREQ 'convert from quoted-printable to base64' '
+	clean_fake_sendmail &&
+	git send-email \
+	  --transfer-encoding=base64 \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  email-using-qp \
+	  2>errors >out &&
+	sed '1,/^$/d' msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' "
+tr -d '\\015' | tr '%' '\\015' > email-using-crlf <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: A U Thor <author@example.com>
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+Content-Type: text/plain; charset=UTF-8
+Subject: Nothing to see here.
+
+Look, I have a CRLF and an = sign!%
+EOF
+"
+
+test_expect_success $PREREQ 'setup expect' '
+cat >expected <<EOF
+Look, I have a CRLF and an =3D sign!=0D
+EOF
+'
+
+test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=quoted-printable' '
+	clean_fake_sendmail &&
+	git send-email \
+	  --transfer-encoding=quoted-printable \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  email-using-crlf \
+	  2>errors >out &&
+	sed '1,/^$/d' msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' '
+cat >expected <<EOF
+TG9vaywgSSBoYXZlIGEgQ1JMRiBhbmQgYW4gPSBzaWduIQ0K
+EOF
+'
+
+test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=base64' '
+	clean_fake_sendmail &&
+	git send-email \
+	  --transfer-encoding=base64 \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  email-using-crlf \
+	  2>errors >out &&
+	sed '1,/^$/d' msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
+
 # Note that the patches in this test are deliberately out of order; we
 # want to make sure it works even if the cover-letter is not in the
 # first mail.
-- 
2.1.0

^ permalink raw reply related	[relevance 52%]

* [PATCH 4/9] send-email: change --no-validate to boolean --[no-]validate
  @ 2008-09-30 12:58 52%       ` Michael Witten
    0 siblings, 1 reply; 200+ results
From: Michael Witten @ 2008-09-30 12:58 UTC (permalink / raw)
  To: spearce; +Cc: git

There is also now a configuration variable:

    sendemail[.<identity>].validate

Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
 Documentation/git-send-email.txt |    9 +++++++--
 git-send-email.perl              |    9 +++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 0c6dbf6..81970f3 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -182,14 +182,16 @@ configuration variable), then authentication is not attempted.
 +
 The --to option must be repeated for each user you want on the to list.
 
---no-validate::
-	Don't perform any sanity checks on patches.
+--[no-]validate::
+	Perform sanity checks on patches.
 	Currently, validation means the following:
 +
 --
 		*	Warn of patches that contain lines longer than 998 characters; this
 			is due to SMTP limits as described by http://www.ietf.org/rfc/rfc2821.txt.
 --
++
+This option can be set with sendemail[.<identity>].validate; default to --validate
 
 
 CONFIGURATION
@@ -242,6 +244,9 @@ sendemail.smtpencryption::
 sendemail.smtpssl::
 	Legacy boolean that sets 'smtpencryption=ssl' if enabled.
 
+sendemail.validate::
+    Boolean override for --[no-]validate.
+
 Author
 ------
 Written by Ryan Anderson <ryan@michonline.com>
diff --git a/git-send-email.perl b/git-send-email.perl
index 2c31a25..3467cf1 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -65,7 +65,7 @@ Options:
    --smtp-ssl                     * Deprecated. Use '--smtp-encryption ssl'.
    --quiet                        * Output one line of info per email.
    --dry-run                      * Don't actually send the emails.
-   --no-validate                  * Don't perform sanity checks on patches.
+   --[no-]validate                * Perform patch sanity checks. Default on.
 
 EOT
 	exit(1);
@@ -147,7 +147,7 @@ my ($quiet, $dry_run) = (0, 0);
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
-my ($no_validate);
+my ($validate);
 my (@suppress_cc);
 
 my %config_bool_settings = (
@@ -155,6 +155,7 @@ my %config_bool_settings = (
     "chainreplyto" => [\$chain_reply_to, 1],
     "suppressfrom" => [\$suppress_from, undef],
     "signedoffcc" => [\$signed_off_cc, undef],
+    "validate" => [\$validate, 1],
 );
 
 my %config_settings = (
@@ -221,7 +222,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
-		    "no-validate" => \$no_validate,
+		    "validate!" => \$validate,
 	 );
 
 unless ($rc) {
@@ -374,7 +375,7 @@ for my $f (@ARGV) {
 	}
 }
 
-if (!$no_validate) {
+if ($validate) {
 	foreach my $f (@files) {
 		unless (-p $f) {
 			my $error = validate_patch($f);
-- 
1.6.0.2.304.gdcf23.dirty

^ permalink raw reply related	[relevance 52%]

* [PATCH] git-send-email: Add AUTH LOGIN support
@ 2011-08-06  0:40 52% Joe Perches
  0 siblings, 0 replies; 200+ results
From: Joe Perches @ 2011-08-06  0:40 UTC (permalink / raw)
  To: git

The current perl Net::SMTP support will not use AUTH LOGIN
when other authentication options are available.

Add an option to force the use of AUTH LOGIN when necessary.
(Like when using my current hosted email server, grumble)

Signed-off-by: Joe Perches <joe@perches.com>
---
 Documentation/git-send-email.txt |    3 +++
 git-send-email.perl              |   19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 327233c..9595773 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -198,6 +198,9 @@ must be used for each option.
 	if a username is not specified (with '--smtp-user' or 'sendemail.smtpuser'),
 	then authentication is not attempted.
 
+--smtp-auth=<authorization_type>::
+	Force the smtp authentication to use a particular type.
+	Currently supported forced style is "login"
 
 Automating
 ~~~~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 98ab33a..37dfbe7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -28,6 +28,7 @@ use File::Temp qw/ tempdir tempfile /;
 use File::Spec::Functions qw(catfile);
 use Error qw(:try);
 use Git;
+use MIME::Base64;
 
 Getopt::Long::Configure qw/ pass_through /;
 
@@ -193,7 +194,7 @@ sub do_edit {
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);
 my ($to_cmd, $cc_cmd);
 my ($smtp_server, $smtp_server_port, @smtp_server_options);
-my ($smtp_authuser, $smtp_encryption);
+my ($smtp_authuser, $smtp_encryption, $smtp_auth);
 my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
 my ($validate, $confirm);
 my (@suppress_cc);
@@ -218,6 +219,7 @@ my %config_settings = (
     "smtpserveroption" => \@smtp_server_options,
     "smtpuser" => \$smtp_authuser,
     "smtppass" => \$smtp_authpass,
+    "smtpauth" => \$smtp_auth,
     "smtpdomain" => \$smtp_domain,
     "to" => \@initial_to,
     "tocmd" => \$to_cmd,
@@ -293,6 +295,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "smtp-pass:s" => \$smtp_authpass,
 		    "smtp-ssl" => sub { $smtp_encryption = 'ssl' },
 		    "smtp-encryption=s" => \$smtp_encryption,
+		    "smtp-auth=s" => \$smtp_auth,
 		    "smtp-debug:i" => \$debug_net_smtp,
 		    "smtp-domain:s" => \$smtp_domain,
 		    "identity=s" => \$identity,
@@ -1111,7 +1114,19 @@ X-Mailer: git-send-email $gitversion
 				system "stty echo";
 			}
 
-			$auth ||= $smtp->auth( $smtp_authuser, $smtp_authpass ) or die $smtp->message;
+			if (defined $smtp_auth && $smtp_auth =~ /^login$/i) {
+
+			    $smtp->datasend("AUTH LOGIN\n");
+			    $smtp->response();
+			    $smtp->datasend(encode_base64("$smtp_authuser"));
+			    $smtp->response();
+			    $smtp->datasend(encode_base64("$smtp_authpass"));
+			    $smtp->response();
+
+			} else {
+
+			    $auth ||= $smtp->auth( $smtp_authuser, $smtp_authpass ) or die $smtp->message;
+			}
 		}
 
 		$smtp->mail( $raw_from ) or die $smtp->message;
-- 
1.7.6.131.g99019

^ permalink raw reply related	[relevance 52%]

* [PATCH RFC 5/6] Docs: send-email: change --no-validate to boolean --[no-]validate
  @ 2008-09-25 20:44 52%         ` Michael Witten
  0 siblings, 0 replies; 200+ results
From: Michael Witten @ 2008-09-25 20:44 UTC (permalink / raw)
  To: gitster; +Cc: git

There is also now a configuration variable:

    sendemail[.<identity>].validate

Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
 Documentation/git-send-email.txt |    9 +++++++--
 git-send-email.perl              |   10 ++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 6031eb7..fe53e9b 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -189,14 +189,16 @@ user is prompted for a password while the input is masked for privacy.
 	variable; if that is unspecified, choosing the envelope sender is left
 	to your MTA.
 
---no-validate::
-	Don't perform any sanity checks on patches.
+--[no-]validate::
+	Perform sanity checks on patches.
 	Currently, validation means the following:
 +
 --
 		*	Warn of patches that contain lines longer than 998 characters; this
 			is due to SMTP limits as described by http://www.ietf.org/rfc/rfc2821.txt.
 --
++
+This option can be set with sendemail[.<identity>].validate; default to --validate
 
 
 CONFIGURATION
@@ -249,6 +251,9 @@ sendemail.smtpencryption::
 sendemail.smtpssl::
 	Legacy boolean that sets 'smtpencryption=ssl' if enabled.
 
+sendemail.validate::
+    Boolean override for --[no-]validate.
+
 Author
 ------
 Written by Ryan Anderson <ryan@michonline.com>
diff --git a/git-send-email.perl b/git-send-email.perl
index b86a3f3..8bc204f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -113,7 +113,8 @@ Options:
    --envelope-sender       Specify the envelope sender used to send the
                            emails.
 
-   --no-validate           Don't perform any sanity checks on patches.
+   --[no-]validate         Perform any sanity checks on patches.
+                           Default to on.
 
 EOT
 	exit(1);
@@ -195,7 +196,7 @@ my ($quiet, $dry_run) = (0, 0);
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
-my ($no_validate);
+my ($validate);
 my (@suppress_cc);
 
 my %config_bool_settings = (
@@ -203,6 +204,7 @@ my %config_bool_settings = (
     "chainreplyto" => [\$chain_reply_to, 1],
     "suppressfrom" => [\$suppress_from, undef],
     "signedoffcc" => [\$signed_off_cc, undef],
+    "validate" => [\$validate, 1],
 );
 
 my %config_settings = (
@@ -269,7 +271,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
-		    "no-validate" => \$no_validate,
+		    "validate!" => \$validate,
 	 );
 
 unless ($rc) {
@@ -422,7 +424,7 @@ for my $f (@ARGV) {
 	}
 }
 
-if (!$no_validate) {
+if ($validate) {
 	foreach my $f (@files) {
 		unless (-p $f) {
 			my $error = validate_patch($f);
-- 
1.6.0.2.302.ge6cbd1

^ permalink raw reply related	[relevance 52%]

* [PATCH 4/8] send-email: change --no-validate to boolean --[no-]validate
  @ 2008-09-28  1:09 52%     ` Michael Witten
  0 siblings, 0 replies; 200+ results
From: Michael Witten @ 2008-09-28  1:09 UTC (permalink / raw)
  To: gitster; +Cc: git

There is also now a configuration variable:

    sendemail[.<identity>].validate

Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
 Documentation/git-send-email.txt |    9 +++++++--
 git-send-email.perl              |    9 +++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 0c6dbf6..81970f3 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -182,14 +182,16 @@ configuration variable), then authentication is not attempted.
 +
 The --to option must be repeated for each user you want on the to list.
 
---no-validate::
-	Don't perform any sanity checks on patches.
+--[no-]validate::
+	Perform sanity checks on patches.
 	Currently, validation means the following:
 +
 --
 		*	Warn of patches that contain lines longer than 998 characters; this
 			is due to SMTP limits as described by http://www.ietf.org/rfc/rfc2821.txt.
 --
++
+This option can be set with sendemail[.<identity>].validate; default to --validate
 
 
 CONFIGURATION
@@ -242,6 +244,9 @@ sendemail.smtpencryption::
 sendemail.smtpssl::
 	Legacy boolean that sets 'smtpencryption=ssl' if enabled.
 
+sendemail.validate::
+    Boolean override for --[no-]validate.
+
 Author
 ------
 Written by Ryan Anderson <ryan@michonline.com>
diff --git a/git-send-email.perl b/git-send-email.perl
index 2c31a25..3467cf1 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -65,7 +65,7 @@ Options:
    --smtp-ssl                     * Deprecated. Use '--smtp-encryption ssl'.
    --quiet                        * Output one line of info per email.
    --dry-run                      * Don't actually send the emails.
-   --no-validate                  * Don't perform sanity checks on patches.
+   --[no-]validate                * Perform patch sanity checks. Default on.
 
 EOT
 	exit(1);
@@ -147,7 +147,7 @@ my ($quiet, $dry_run) = (0, 0);
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
-my ($no_validate);
+my ($validate);
 my (@suppress_cc);
 
 my %config_bool_settings = (
@@ -155,6 +155,7 @@ my %config_bool_settings = (
     "chainreplyto" => [\$chain_reply_to, 1],
     "suppressfrom" => [\$suppress_from, undef],
     "signedoffcc" => [\$signed_off_cc, undef],
+    "validate" => [\$validate, 1],
 );
 
 my %config_settings = (
@@ -221,7 +222,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
-		    "no-validate" => \$no_validate,
+		    "validate!" => \$validate,
 	 );
 
 unless ($rc) {
@@ -374,7 +375,7 @@ for my $f (@ARGV) {
 	}
 }
 
-if (!$no_validate) {
+if ($validate) {
 	foreach my $f (@files) {
 		unless (-p $f) {
 			my $error = validate_patch($f);
-- 
1.6.0.2.304.g577ee

^ permalink raw reply related	[relevance 52%]

* [[PATCH v2]] git-send-email: Added the ability to query the number of smtp password questions
  @ 2013-11-10 11:56 52%   ` silvio
  0 siblings, 0 replies; 200+ results
From: silvio @ 2013-11-10 11:56 UTC (permalink / raw)
  To: git; +Cc: Silvio F

From: Silvio F <silvio.fricke@gmail.com>

With this patch "git-send-mail" ask a configurable number of questions to
input the smtp password. Without this patch we have only one trial.

Signed-off-by: Silvio F <silvio.fricke@gmail.com>
---
 Documentation/git-send-email.txt |  4 ++++
 git-send-email.perl              | 32 +++++++++++++++++++++-----------
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index f0e57a5..ac993d6 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -364,6 +364,10 @@ sendemail.confirm::
 	one of 'always', 'never', 'cc', 'compose', or 'auto'. See '--confirm'
 	in the previous section for the meaning of these values.
 
+sendmail.askpasswordcount::
+	Number of times the smtp password can be entered before sending mail is
+	aborted. Default is 1.
+
 EXAMPLE
 -------
 Use gmail as the smtp server
diff --git a/git-send-email.perl b/git-send-email.perl
index 3782c3b..aeb2e6d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -203,6 +203,7 @@ my ($validate, $confirm);
 my (@suppress_cc);
 my ($auto_8bit_encoding);
 my ($compose_encoding);
+my ($askpasswordcount) = 1;
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -237,6 +238,7 @@ my %config_settings = (
     "from" => \$sender,
     "assume8bitencoding" => \$auto_8bit_encoding,
     "composeencoding" => \$compose_encoding,
+    "askpasswordcount" => \$askpasswordcount
 );
 
 my %config_path_settings = (
@@ -360,6 +362,10 @@ sub read_config {
 		}
 	}
 
+	if ($askpasswordcount < 1) {
+		$askpasswordcount = 1;
+	}
+
 	if (!defined $smtp_encryption) {
 		my $enc = Git::config(@repo, "$prefix.smtpencryption");
 		if (defined $enc) {
@@ -1069,17 +1075,21 @@ sub smtp_auth_maybe {
 	# TODO: Authentication may fail not because credentials were
 	# invalid but due to other reasons, in which we should not
 	# reject credentials.
-	$auth = Git::credential({
-		'protocol' => 'smtp',
-		'host' => smtp_host_string(),
-		'username' => $smtp_authuser,
-		# if there's no password, "git credential fill" will
-		# give us one, otherwise it'll just pass this one.
-		'password' => $smtp_authpass
-	}, sub {
-		my $cred = shift;
-		return !!$smtp->auth($cred->{'username'}, $cred->{'password'});
-	});
+	for my $i (1 .. $askpasswordcount) {
+		$auth = Git::credential({
+			'protocol' => 'smtp',
+			'host' => smtp_host_string(),
+			'username' => $smtp_authuser,
+			# if there's no password, "git credential fill" will
+			# give us one, otherwise it'll just pass this one.
+			'password' => $smtp_authpass
+		}, sub {
+			my $cred = shift;
+			return !!$smtp->auth($cred->{'username'}, $cred->{'password'});
+		});
+
+		last if ($auth);
+	}
 
 	return $auth;
 }
-- 
1.8.4.2

^ permalink raw reply related	[relevance 52%]

* Re: `git-send-email' doesn't specify `Content-Type'
  @ 2007-11-11  8:32 53%           ` Jeff King
  0 siblings, 0 replies; 200+ results
From: Jeff King @ 2007-11-11  8:32 UTC (permalink / raw)
  To: Björn Steinbrink
  Cc: Brian Swetland, Johannes Schindelin, Ludovic Courtès, git

On Sat, Nov 10, 2007 at 01:51:26PM +0100, Björn Steinbrink wrote:

> On 2007.11.10 04:35:05 -0800, Brian Swetland wrote:
> > The first line of the patch is a From: field with Arve's name, in
> > an (rfc822?) encoded format):
> > From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>

It's rfc2047 (and you can grep for that in git-send-email).

> Ah! Commit author differs from mail sender, didn't think of that. That's
> probably the same problem as with the -s option, ie. that git-send-email
> only looks at the existing text and not add anything it adds itself when
> checking the encoding. Sorry for the noise.

It's not the same problem; the '-s' problem was git-format-patch, and
this is git-send-email. In fact, git-format-patch correctly notes the
encoding in the header. It is git-send-email in this case that takes the
encoded and properly marked header, deciphers it, throws away the
original encoding, and sticks it into the message body without
considering the encoding of the body.

So I think you would want to:
  1. remember the encoding pulled from the rfc2047 header
  2. When prepending the author line to the message, consider the
     body encoding.
  2a. If no encoding, then the body is US-ASCII and we can presumably
      just add
         MIME-Version: 1.0
         Content-Type: text/plain; charset=$enc
  2b. If there is an encoding, we need to Iconv from the name
      encoding to the body encoding.

However, as it stands now, our rfc2047 unquoting _always_ assumes that
we are in utf-8 for the name (which is probably true if the messages
came out of git-format-patch with default-ish settings). So the easy,
hackish way is probably to just add the MIME-Version and 'Content-type:
text/plain; charset=utf-8' headers if we unquoted the author field.

If we want to accept arbitrary messages, below is a patch to at least
have unquote_rfc2047 return the right information (and then on
git-send-email.perl:758, where we prepend $author, the encoding would
need to be taken into account as I described above).

Given that git-send-email is already pretty dependent on
git-format-patch output (and nobody has been complaining about its
rfc2047 handling so far!) the easy, hackish way is probably the best.

-Peff

---
diff --git a/git-send-email.perl b/git-send-email.perl
index f9bd2e5..4f8297f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -514,11 +514,13 @@ $time = time - scalar $#files;
 
 sub unquote_rfc2047 {
 	local ($_) = @_;
-	if (s/=\?utf-8\?q\?(.*)\?=/$1/g) {
+	my $encoding;
+	if (s/=\?([^?])+\?q\?(.*)\?=/$2/g) {
+		$encoding = $1;
 		s/_/ /g;
 		s/=([0-9A-F]{2})/chr(hex($1))/eg;
 	}
-	return "$_";
+	return "$_", $encoding;
 }
 
 # use the simplest quoting being able to handle the recipient
@@ -667,6 +669,7 @@ foreach my $t (@files) {
 	open(F,"<",$t) or die "can't open file $t";
 
 	my $author = undef;
+	my $author_encoding;
 	@cc = @initial_cc;
 	@xh = ();
 	my $input_format = undef;
@@ -692,7 +695,8 @@ foreach my $t (@files) {
 						next if ($suppress_from);
 					}
 					elsif ($1 eq 'From') {
-						$author = unquote_rfc2047($2);
+						($author, $author_encoding)
+						  = unquote_rfc2047($2);
 					}
 					printf("(mbox) Adding cc: %s from line '%s'\n",
 						$2, $_) unless $quiet;

^ permalink raw reply related	[relevance 53%]

* [PATCH] send-email: avoid duplicate specification warnings
@ 2023-11-14 16:38 53% Todd Zullinger
  0 siblings, 0 replies; 200+ results
From: Todd Zullinger @ 2023-11-14 16:38 UTC (permalink / raw)
  To: git
  Cc: Ævar Arnfjörð Bjarmason, Jeff King,
	Ondřej Pohořelský

With perl-Getopt-Long >= 2.55, a warning is issued for options which are
specified more than once.  In addition to causing users to see warnings,
this results in test failures which compare the output.  An example,
from t9001-send-email.37:

  | +++ diff -u expect actual
  | --- expect      2023-11-14 10:38:23.854346488 +0000
  | +++ actual      2023-11-14 10:38:23.848346466 +0000
  | @@ -1,2 +1,7 @@
  | +Duplicate specification "no-chain-reply-to" for option "no-chain-reply-to"
  | +Duplicate specification "to-cover|to-cover!" for option "to-cover"
  | +Duplicate specification "cc-cover|cc-cover!" for option "cc-cover"
  | +Duplicate specification "no-thread" for option "no-thread"
  | +Duplicate specification "no-to-cover" for option "no-to-cover"
  |  fatal: longline.patch:35 is longer than 998 characters
  |  warning: no patches were sent
  | error: last command exited with $?=1
  | not ok 37 - reject long lines

Remove the duplicate option specs.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
---

I've run this through the full test suite.  I also compared the output of
--help to ensure it only differs in the removal of the "Duplicate
specification" warnings.  I _think_ that's a good sign that no other changes
will result.  But I would be grateful to anyone who can confirm or reject that
theory.

 git-send-email.perl | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index cacdbd6bb2..13d9c47fe5 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -491,7 +491,6 @@ sub config_regexp {
 		    "bcc=s" => \@getopt_bcc,
 		    "no-bcc" => \$no_bcc,
 		    "chain-reply-to!" => \$chain_reply_to,
-		    "no-chain-reply-to" => sub {$chain_reply_to = 0},
 		    "sendmail-cmd=s" => \$sendmail_cmd,
 		    "smtp-server=s" => \$smtp_server,
 		    "smtp-server-option=s" => \@smtp_server_options,
@@ -506,36 +505,27 @@ sub config_regexp {
 		    "smtp-auth=s" => \$smtp_auth,
 		    "no-smtp-auth" => sub {$smtp_auth = 'none'},
 		    "annotate!" => \$annotate,
-		    "no-annotate" => sub {$annotate = 0},
 		    "compose" => \$compose,
 		    "quiet" => \$quiet,
 		    "cc-cmd=s" => \$cc_cmd,
 		    "header-cmd=s" => \$header_cmd,
 		    "no-header-cmd" => \$no_header_cmd,
 		    "suppress-from!" => \$suppress_from,
-		    "no-suppress-from" => sub {$suppress_from = 0},
 		    "suppress-cc=s" => \@suppress_cc,
-		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
-		    "no-signed-off-cc|no-signed-off-by-cc" => sub {$signed_off_by_cc = 0},
-		    "cc-cover|cc-cover!" => \$cover_cc,
-		    "no-cc-cover" => sub {$cover_cc = 0},
-		    "to-cover|to-cover!" => \$cover_to,
-		    "no-to-cover" => sub {$cover_to = 0},
+		    "signed-off-by-cc!" => \$signed_off_by_cc,
+		    "cc-cover!" => \$cover_cc,
+		    "to-cover!" => \$cover_to,
 		    "confirm=s" => \$confirm,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
-		    "no-thread" => sub {$thread = 0},
 		    "validate!" => \$validate,
-		    "no-validate" => sub {$validate = 0},
 		    "transfer-encoding=s" => \$target_xfer_encoding,
 		    "format-patch!" => \$format_patch,
-		    "no-format-patch" => sub {$format_patch = 0},
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
 		    "compose-encoding=s" => \$compose_encoding,
 		    "force" => \$force,
 		    "xmailer!" => \$use_xmailer,
-		    "no-xmailer" => sub {$use_xmailer = 0},
 		    "batch-size=i" => \$batch_size,
 		    "relogin-delay=i" => \$relogin_delay,
 		    "git-completion-helper" => \$git_completion_helper,


^ permalink raw reply related	[relevance 53%]

* [PATCH RFC 5/6] Docs: send-email: change --no-validate to boolean --[no-]validate
  @ 2008-09-22 15:58 53%       ` Michael Witten
  0 siblings, 0 replies; 200+ results
From: Michael Witten @ 2008-09-22 15:58 UTC (permalink / raw)
  To: git

There is also now a configuration variable:

    sendemail[.<identity>].validate

Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
 Documentation/git-send-email.txt |    9 +++++++--
 git-send-email.perl              |   10 ++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 6031eb7..fe53e9b 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -189,14 +189,16 @@ user is prompted for a password while the input is masked for privacy.
 	variable; if that is unspecified, choosing the envelope sender is left
 	to your MTA.
 
---no-validate::
-	Don't perform any sanity checks on patches.
+--[no-]validate::
+	Perform sanity checks on patches.
 	Currently, validation means the following:
 +
 --
 		*	Warn of patches that contain lines longer than 998 characters; this
 			is due to SMTP limits as described by http://www.ietf.org/rfc/rfc2821.txt.
 --
++
+This option can be set with sendemail[.<identity>].validate; default to --validate
 
 
 CONFIGURATION
@@ -249,6 +251,9 @@ sendemail.smtpencryption::
 sendemail.smtpssl::
 	Legacy boolean that sets 'smtpencryption=ssl' if enabled.
 
+sendemail.validate::
+    Boolean override for --[no-]validate.
+
 Author
 ------
 Written by Ryan Anderson <ryan@michonline.com>
diff --git a/git-send-email.perl b/git-send-email.perl
index b86a3f3..8bc204f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -113,7 +113,8 @@ Options:
    --envelope-sender       Specify the envelope sender used to send the
                            emails.
 
-   --no-validate           Don't perform any sanity checks on patches.
+   --[no-]validate         Perform any sanity checks on patches.
+                           Default to on.
 
 EOT
 	exit(1);
@@ -195,7 +196,7 @@ my ($quiet, $dry_run) = (0, 0);
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
-my ($no_validate);
+my ($validate);
 my (@suppress_cc);
 
 my %config_bool_settings = (
@@ -203,6 +204,7 @@ my %config_bool_settings = (
     "chainreplyto" => [\$chain_reply_to, 1],
     "suppressfrom" => [\$suppress_from, undef],
     "signedoffcc" => [\$signed_off_cc, undef],
+    "validate" => [\$validate, 1],
 );
 
 my %config_settings = (
@@ -269,7 +271,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
-		    "no-validate" => \$no_validate,
+		    "validate!" => \$validate,
 	 );
 
 unless ($rc) {
@@ -422,7 +424,7 @@ for my $f (@ARGV) {
 	}
 }
 
-if (!$no_validate) {
+if ($validate) {
 	foreach my $f (@files) {
 		unless (-p $f) {
 			my $error = validate_patch($f);
-- 
1.6.0.2.302.ge6cbd1

^ permalink raw reply related	[relevance 53%]

* [PATCH 01/12] send-email: drop FakeTerm hack
    2024-05-21 19:56 59% ` [PATCH 02/12] send-email: avoid creating more than one Term::ReadLine object Junio C Hamano
@ 2024-05-21 19:56 53% ` Junio C Hamano
  1 sibling, 0 replies; 200+ results
From: Junio C Hamano @ 2024-05-21 19:56 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Taylor Blau

From: Jeff King <peff@peff.net>

Back in 280242d1cc (send-email: do not barf when Term::ReadLine does not
like your terminal, 2006-07-02), we added a fallback for when
Term::ReadLine's constructor failed: we'd have a FakeTerm object
instead, which would then die if anybody actually tried to call
readline() on it. Since we instantiated the $term variable at program
startup, we needed this workaround to let the program run in modes when
we did not prompt the user.

But later, in f4dc9432fd (send-email: lazily load modules for a big
speedup, 2021-05-28), we started loading Term::ReadLine lazily only when
ask() is called. So at that point we know we're trying to prompt the
user, and we can just die if ReadLine instantiation fails, rather than
making this fake object to lazily delay showing the error.

This should be OK even if there is no tty (e.g., we're in a cron job),
because Term::ReadLine will return a stub object in that case whose "IN"
and "OUT" functions return undef. And since 5906f54e47 (send-email:
don't attempt to prompt if tty is closed, 2009-03-31), we check for that
case and skip prompting.

And we can be sure that FakeTerm was not kicking in for such a
situation, because it has actually been broken since that commit! It
does not define "IN" or "OUT" methods, so perl would barf with an error.
If FakeTerm was in use, we were neither honoring what 5906f54e47 tried
to do, nor producing the readable message that 280242d1cc intended.

So we're better off just dropping FakeTerm entirely, and letting the
error reported by constructing Term::ReadLine through.

[jc: cherry-picked from v2.42.0-rc2~6^2~1]

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-send-email.perl | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 5861e99a6e..72d876f0a0 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -26,18 +26,6 @@
 
 Getopt::Long::Configure qw/ pass_through /;
 
-package FakeTerm;
-sub new {
-	my ($class, $reason) = @_;
-	return bless \$reason, shift;
-}
-sub readline {
-	my $self = shift;
-	die "Cannot use readline on FakeTerm: $$self";
-}
-package main;
-
-
 sub usage {
 	print <<EOT;
 git send-email' [<options>] <file|directory>
@@ -930,16 +918,10 @@ sub get_patch_subject {
 }
 
 sub term {
-	my $term = eval {
-		require Term::ReadLine;
-		$ENV{"GIT_SEND_EMAIL_NOTTY"}
+	require Term::ReadLine;
+	return $ENV{"GIT_SEND_EMAIL_NOTTY"}
 			? Term::ReadLine->new('git-send-email', \*STDIN, \*STDOUT)
 			: Term::ReadLine->new('git-send-email');
-	};
-	if ($@) {
-		$term = FakeTerm->new("$@: going non-interactive");
-	}
-	return $term;
 }
 
 sub ask {
-- 
2.45.1-216-g4365c6fcf9



^ permalink raw reply related	[relevance 53%]

* [PATCH RESEND] send-email: add 'specify-author' option
@ 2012-04-06 12:21 53% Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2012-04-06 12:21 UTC (permalink / raw)
  To: git
  Cc: Felipe Contreras, Thomas Rast, Pierre Habouzit, Michael Witten,
	Pascal Obry, Jay Soffian, David Brown, Adam Roben,
	Nanako Shiraishi, Matthew Wilcox, Robin H. Johnson

Some mail servers (Microsoft Exchange) mangle the 'From' header, so
while applying the patches, the author has to be fixed manually.

This option allows to always specify the author of the commit in the
body of the message, even if the committer is the author.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-send-email.txt |    4 ++++
 git-send-email.perl              |    9 +++++++--
 t/t9001-send-email.sh            |   12 ++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3241170..9bd1379 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -126,6 +126,10 @@ The --to option must be repeated for each user you want on the to list.
 +
 Note that no attempts whatsoever are made to validate the encoding.
 
+--specify-author::
+	Always specify the author of the commit in the body of the message,
+	even if the committer is the author. This is useful if the 'From'
+	header is mangled by some mail server.
 
 Sending
 ~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index ef30c55..f18ad16 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -57,6 +57,8 @@ git send-email [options] <file | directory | rev-list options >
     --annotate                     * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
     --8bit-encoding         <str>  * Encoding to assume 8bit mails if undeclared
+    --specify-author               * Always specify the author of the commit in
+			             the body of the message.
 
   Sending:
     --envelope-sender       <str>  * Email envelope sender.
@@ -198,6 +200,7 @@ my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
 my ($validate, $confirm);
 my (@suppress_cc);
 my ($auto_8bit_encoding);
+my ($specify_author);
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -210,7 +213,8 @@ my %config_bool_settings = (
     "signedoffbycc" => [\$signed_off_by_cc, undef],
     "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
     "validate" => [\$validate, 1],
-    "multiedit" => [\$multiedit, undef]
+    "multiedit" => [\$multiedit, undef],
+    "specifyauthor" => [\$specify_author, undef],
 );
 
 my %config_settings = (
@@ -316,6 +320,7 @@ my $rc = GetOptions("h" => \$help,
 		    "format-patch!" => \$format_patch,
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
 		    "force" => \$force,
+		    "specify-author!" => \$specify_author,
 	 );
 
 usage() if $help;
@@ -1310,7 +1315,7 @@ foreach my $t (@files) {
 		$subject = quote_rfc2047($subject, $auto_8bit_encoding);
 	}
 
-	if (defined $author and $author ne $sender) {
+	if (defined $author and ($author ne $sender or $specify_author)) {
 		$message = "From: $author\n\n$message";
 		if (defined $author_encoding) {
 			if ($has_content_type) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 8c12c65..1dab17e 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -281,6 +281,18 @@ test_expect_success $PREREQ 'Author From: not in message body' '
 	! grep "From: A <author@example.com>" msgbody1
 '
 
+test_expect_success $PREREQ 'Author From: in message body (forced)' '
+	clean_fake_sendmail &&
+	git send-email \
+		--from="A <author@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		--specify-author \
+		$patches &&
+	sed "1,/^\$/d" < msgtxt1 > msgbody1 &&
+	grep "From: A <author@example.com>" msgbody1
+'
+
 test_expect_success $PREREQ 'allow long lines with --no-validate' '
 	git send-email \
 		--from="Example <nobody@example.com>" \
-- 
1.7.9.6

^ permalink raw reply related	[relevance 53%]

* [PATCH] Change git-send-email's sendemail-validate hook to use header information
@ 2022-11-09 18:23 53% Strawbridge, Michael
  0 siblings, 0 replies; 200+ results
From: Strawbridge, Michael @ 2022-11-09 18:23 UTC (permalink / raw)
  To: git@vger.kernel.org
  Cc: Strawbridge, Michael, Tuikov, Luben, brian m . carlson

Since commit-msg and pre-commit git hooks already expose commit
contents, switch sendemail-validate to use the header information
of the email that git-send-email intends to send.

Cc: Luben Tuikov <luben.tuikov@amd.com>
Cc: brian m. carlson <sandals@crustytoothpaste.net>
---
 git-send-email.perl | 57 +++++++++++++++++++++++++++++----------------
 1 file changed, 37 insertions(+), 20 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 5861e99a6e..3ea6fda48e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -787,14 +787,6 @@ sub is_format_patch_arg {
 
 @files = handle_backup_files(@files);
 
-if ($validate) {
-	foreach my $f (@files) {
-		unless (-p $f) {
-			validate_patch($f, $target_xfer_encoding);
-		}
-	}
-}
-
 if (@files) {
 	unless ($quiet) {
 		print $_,"\n" for (@files);
@@ -1495,16 +1487,7 @@ sub file_name_is_absolute {
 	return File::Spec::Functions::file_name_is_absolute($path);
 }
 
-# Prepares the email, then asks the user what to do.
-#
-# If the user chooses to send the email, it's sent and 1 is returned.
-# If the user chooses not to send the email, 0 is returned.
-# If the user decides they want to make further edits, -1 is returned and the
-# caller is expected to call send_message again after the edits are performed.
-#
-# If an error occurs sending the email, this just dies.
-
-sub send_message {
+sub gen_header {
 	my @recipients = unique_email_list(@to);
 	@cc = (grep { my $cc = extract_valid_address_or_die($_);
 		      not grep { $cc eq $_ || $_ =~ /<\Q${cc}\E>$/ } @recipients
@@ -1546,6 +1529,22 @@ sub send_message {
 	if (@xh) {
 		$header .= join("\n", @xh) . "\n";
 	}
+	return $header;
+}
+
+# Prepares the email, then asks the user what to do.
+#
+# If the user chooses to send the email, it's sent and 1 is returned.
+# If the user chooses not to send the email, 0 is returned.
+# If the user decides they want to make further edits, -1 is returned and the
+# caller is expected to call send_message again after the edits are performed.
+#
+# If an error occurs sending the email, this just dies.
+
+sub send_message {
+	my @recipients = unique_email_list(@to);
+
+        my $header = gen_header();
 
 	my @sendmail_parameters = ('-i', @recipients);
 	my $raw_from = $sender;
@@ -1955,6 +1954,15 @@ sub process_file {
 		}
 	}
 
+
+	if ($validate) {
+		foreach my $f (@files) {
+			unless (-p $f) {
+				validate_patch($f, $target_xfer_encoding);
+			}
+		}
+	}
+
 	my $message_was_sent = send_message();
 	if ($message_was_sent == -1) {
 		do_edit($t);
@@ -2088,11 +2096,20 @@ sub validate_patch {
 			chdir($repo->wc_path() or $repo->repo_path())
 				or die("chdir: $!");
 			local $ENV{"GIT_DIR"} = $repo->repo_path();
+
+			my $header = gen_header();
+
+			require File::Temp;
+			my ($header_filehandle, $header_filename) = File::Temp::tempfile(
+                            ".gitsendemail.header.XXXXXX", DIR => $repo->repo_path());
+			print $header_filehandle $header;
+
 			my @cmd = ("git", "hook", "run", "--ignore-missing",
 				    $hook_name, "--");
-			my @cmd_msg = (@cmd, "<patch>");
-			my @cmd_run = (@cmd, $target);
+			my @cmd_msg = (@cmd, "<header>");
+			my @cmd_run = (@cmd, $header_filename);
 			$hook_error = system_or_msg(\@cmd_run, undef, "@cmd_msg");
+			unlink($header_filehandle);
 			chdir($cwd_save) or die("chdir: $!");
 		}
 		if ($hook_error) {
-- 
2.34.1

^ permalink raw reply related	[relevance 53%]

* [PATCH 2/2] send-email: fix threaded mails without chain-reply-to
  @ 2009-06-07 15:20 53%   ` Markus Heidelberg
  0 siblings, 0 replies; 200+ results
From: Markus Heidelberg @ 2009-06-07 15:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Michael Witten, Markus Heidelberg

These commands didn't send threaded mails anymore:

    $ git format-patch <revision range>
    $ git send-email --thread --no-chain-reply-to <files>

This regression was introduced in commit 15da108 ("send-email:
'References:' should only reference what is sent", 2009-04-13) by a
hidden code style change:

    ! defined $reply_to || length($reply_to) == 0
was changed to
    not defined $reply_to || length($reply_to) == 0
which is
    not (defined $reply_to || length($reply_to) == 0)
instead of
    (not defined $reply_to) || (length($reply_to) == 0)

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 git-send-email.perl   |    2 +-
 t/t9001-send-email.sh |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 3d6a982..c914bff 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1142,7 +1142,7 @@ foreach my $t (@files) {
 	my $message_was_sent = send_message();
 
 	# set up for the next message
-	if ($message_was_sent and $chain_reply_to || not defined $reply_to || length($reply_to) == 0) {
+	if ($message_was_sent and $chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
 		$reply_to = $message_id;
 		if (length $references > 0) {
 			$references .= "\n $message_id";
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 576bbd3..bb03aa4 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -621,7 +621,7 @@ test_expect_success 'in-reply-to but no threading' '
 	grep "In-Reply-To: <in-reply-id@example.com>"
 '
 
-test_expect_failure 'threading but no chain-reply-to' '
+test_expect_success 'threading but no chain-reply-to' '
 	git send-email \
 		--dry-run \
 		--from="Example <nobody@example.com>" \
-- 
1.6.3.2.216.g24c61

^ permalink raw reply related	[relevance 53%]

* [PATCH 3/6] send-email: fix threaded mails without chain-reply-to
  @ 2009-06-07 21:40 53% ` Markus Heidelberg
    2009-06-07 21:40 51% ` [PATCH 5/6] " Markus Heidelberg
  1 sibling, 1 reply; 200+ results
From: Markus Heidelberg @ 2009-06-07 21:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Markus Heidelberg, Michael Witten

These commands didn't send threaded mails anymore:

    $ git format-patch <revision range>
    $ git send-email --thread --no-chain-reply-to <files>

This regression was introduced in commit 15da108 ("send-email:
'References:' should only reference what is sent", 2009-04-13) by a
hidden code style change:

    ! defined $reply_to || length($reply_to) == 0
was changed to
    not defined $reply_to || length($reply_to) == 0
which is
    not (defined $reply_to || length($reply_to) == 0)
instead of
    (not defined $reply_to) || (length($reply_to) == 0)

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 git-send-email.perl   |    2 +-
 t/t9001-send-email.sh |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 5b7ab4e..c11a245 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1142,7 +1142,7 @@ foreach my $t (@files) {
 	my $message_was_sent = send_message();
 
 	# set up for the next message
-	if ($message_was_sent and $chain_reply_to || not defined $reply_to || length($reply_to) == 0) {
+	if ($message_was_sent and $chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
 		$reply_to = $message_id;
 		if (length $references > 0) {
 			$references .= "\n $message_id";
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 4ccca44..41af35a 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -621,7 +621,7 @@ test_expect_success 'in-reply-to but no threading' '
 	grep "In-Reply-To: <in-reply-id@example.com>"
 '
 
-test_expect_failure 'threading but no chain-reply-to' '
+test_expect_success 'threading but no chain-reply-to' '
 	git send-email \
 		--dry-run \
 		--from="Example <nobody@example.com>" \
-- 
1.6.3.2.221.g0ff2f

^ permalink raw reply related	[relevance 53%]

* [PATCH] send-email: clarify SMTP encryption settings
@ 2021-04-09 21:18 53% Drew DeVault
  0 siblings, 0 replies; 200+ results
From: Drew DeVault @ 2021-04-09 21:18 UTC (permalink / raw)
  To: git; +Cc: Drew DeVault

The present options are misleading; "ssl" enables generic, "modern" SSL
support, which could use either SSL or TLS; and "tls" enables the
SMTP-specific (and deprecated) STARTTLS protocol.

This changes the canonical config options to "ssl/tls" and "starttls",
updates the docs to explain the options in more detail, and updates
git-send-email to accept either form.
---
 Documentation/git-send-email.txt | 11 ++++++++---
 git-send-email.perl              |  4 ++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 93708aefea..3597935e41 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -168,9 +168,14 @@ Sending
 	unspecified, choosing the envelope sender is left to your MTA.
 
 --smtp-encryption=<encryption>::
-	Specify the encryption to use, either 'ssl' or 'tls'.  Any other
-	value reverts to plain SMTP.  Default is the value of
-	`sendemail.smtpEncryption`.
+	Specify the encryption to use, either 'ssl/tls' or 'starttls', whichever
+	is recommended by your email service provider.  SSL/TLS is typically
+	used on port 465 and is preferred if available.  STARTTLS is typically
+	used on port 25 or 587. Any other value reverts to plain SMTP.  The
+	default is the value of `sendemail.smtpEncryption`.
++
+For legacy reasons, 'ssl' is accepted for 'ssl/tls' and 'tls' is accepted for
+'starttls'.
 
 --smtp-domain=<FQDN>::
 	Specifies the Fully Qualified Domain Name (FQDN) used in the
diff --git a/git-send-email.perl b/git-send-email.perl
index f5bbf1647e..34fdf587bd 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1503,7 +1503,7 @@ sub send_message {
 		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("2.34");
 		$smtp_domain ||= maildomain();
 
-		if ($smtp_encryption eq 'ssl') {
+		if ($smtp_encryption eq 'ssl' || $smtp_encryption eq 'ssl/tls') {
 			$smtp_server_port ||= 465; # ssmtp
 			require IO::Socket::SSL;
 
@@ -1538,7 +1538,7 @@ sub send_message {
 						 Hello => $smtp_domain,
 						 Debug => $debug_net_smtp,
 						 Port => $smtp_server_port);
-			if ($smtp_encryption eq 'tls' && $smtp) {
+			if (($smtp_encryption eq 'tls' || $smtp_encryption eq 'starttls') && $smtp) {
 				if ($use_net_smtp_ssl) {
 					$smtp->command('STARTTLS');
 					$smtp->response();
-- 
2.31.1


^ permalink raw reply related	[relevance 53%]

* [RFC2 9/9] send-email: signedoffcc -> signedoffbycc, but handle both
  @ 2008-09-29 17:41 53%   ` Michael Witten
  0 siblings, 0 replies; 200+ results
From: Michael Witten @ 2008-09-29 17:41 UTC (permalink / raw)
  To: git; +Cc: Jeff King

The documentation now mentions sendemail.signedoffbycc instead
of sendemail.signedoffcc in order to match with the options
--signed-off-by-cc; the code has been updated to reflect this
as well, but sendemail.signedoffcc is still handled.

Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
 Documentation/git-send-email.txt |    2 +-
 git-send-email.perl              |    9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index d566c34..82f5056 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -144,7 +144,7 @@ Automating
 
 --[no-]signed-off-by-cc::
 	If this is set, add emails found in Signed-off-by: or Cc: lines to the
-	cc list. Default is the value of 'sendemail.signedoffcc' configuration
+	cc list. Default is the value of 'sendemail.signedoffbycc' configuration
 	value; if that is unspecified, default to --signed-off-by-cc.
 
 --suppress-cc::
diff --git a/git-send-email.perl b/git-send-email.perl
index 80dae88..bdbfac6 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -151,7 +151,7 @@ if ($@) {
 my ($quiet, $dry_run) = (0, 0);
 
 # Variables with corresponding config settings
-my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
+my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
 my ($validate);
@@ -161,7 +161,8 @@ my %config_bool_settings = (
     "thread" => [\$thread, 1],
     "chainreplyto" => [\$chain_reply_to, 1],
     "suppressfrom" => [\$suppress_from, undef],
-    "signedoffcc" => [\$signed_off_cc, undef],
+    "signedoffbycc" => [\$signed_off_by_cc, undef],
+    "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
     "validate" => [\$validate, 1],
 );
 
@@ -225,7 +226,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "cc-cmd=s" => \$cc_cmd,
 		    "suppress-from!" => \$suppress_from,
 		    "suppress-cc=s" => \@suppress_cc,
-		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
+		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
@@ -301,7 +302,7 @@ if ($suppress_cc{'all'}) {
 
 # If explicit old-style ones are specified, they trump --suppress-cc.
 $suppress_cc{'self'} = $suppress_from if defined $suppress_from;
-$suppress_cc{'sob'} = !$signed_off_cc if defined $signed_off_cc;
+$suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc;
 
 # Debugging, print out the suppressions.
 if (0) {
-- 
1.6.0.2.304.gdcf23.dirty

^ permalink raw reply related	[relevance 53%]

* [PATCH 9/9] send-email: signedoffcc -> signedoffbycc, but handle both
  @ 2008-09-30 12:58 53%                 ` Michael Witten
  0 siblings, 0 replies; 200+ results
From: Michael Witten @ 2008-09-30 12:58 UTC (permalink / raw)
  To: spearce; +Cc: git

The documentation now mentions sendemail.signedoffbycc instead
of sendemail.signedoffcc in order to match with the options
--signed-off-by-cc; the code has been updated to reflect this
as well, but sendemail.signedoffcc is still handled.

Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
 Documentation/git-send-email.txt |    2 +-
 git-send-email.perl              |    9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index d566c34..82f5056 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -144,7 +144,7 @@ Automating
 
 --[no-]signed-off-by-cc::
 	If this is set, add emails found in Signed-off-by: or Cc: lines to the
-	cc list. Default is the value of 'sendemail.signedoffcc' configuration
+	cc list. Default is the value of 'sendemail.signedoffbycc' configuration
 	value; if that is unspecified, default to --signed-off-by-cc.
 
 --suppress-cc::
diff --git a/git-send-email.perl b/git-send-email.perl
index 80dae88..bdbfac6 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -151,7 +151,7 @@ if ($@) {
 my ($quiet, $dry_run) = (0, 0);
 
 # Variables with corresponding config settings
-my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
+my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
 my ($validate);
@@ -161,7 +161,8 @@ my %config_bool_settings = (
     "thread" => [\$thread, 1],
     "chainreplyto" => [\$chain_reply_to, 1],
     "suppressfrom" => [\$suppress_from, undef],
-    "signedoffcc" => [\$signed_off_cc, undef],
+    "signedoffbycc" => [\$signed_off_by_cc, undef],
+    "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
     "validate" => [\$validate, 1],
 );
 
@@ -225,7 +226,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "cc-cmd=s" => \$cc_cmd,
 		    "suppress-from!" => \$suppress_from,
 		    "suppress-cc=s" => \@suppress_cc,
-		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
+		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
@@ -301,7 +302,7 @@ if ($suppress_cc{'all'}) {
 
 # If explicit old-style ones are specified, they trump --suppress-cc.
 $suppress_cc{'self'} = $suppress_from if defined $suppress_from;
-$suppress_cc{'sob'} = !$signed_off_cc if defined $signed_off_cc;
+$suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc;
 
 # Debugging, print out the suppressions.
 if (0) {
-- 
1.6.0.2.304.gdcf23.dirty

^ permalink raw reply related	[relevance 53%]

* Re: [RFC][PATCH] send-email: add --[no-]xmailer option
  @ 2014-12-03 17:23 53%   ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2014-12-03 17:23 UTC (permalink / raw)
  To: Luis Henriques; +Cc: git

Junio C Hamano <gitster@pobox.com> writes:

> Two problems here.
> ...
> tests?

Something like this squashed into the patch you posted earlier,
perhaps, would be a good place to start.

 Documentation/git-send-email.txt |  6 ++++--
 git-send-email.perl              | 11 +++++------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index f2425ef..a0bd806 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -132,8 +132,10 @@ Note that no attempts whatsoever are made to validate the encoding.
 	'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
 
 --xmailer::
-	Prevent adding the "X-Mailer:" header.  Default value is
-	'sendemail.xmailer'.
+--no-xmailer::
+	Add (or prevent adding) the "X-Mailer:" header.  By default,
+	the header is added, but it can be turned off by setting the
+	`sendemail.xmailer` configuration variable to `false`.
 
 Sending
 ~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 9ca7c5b..a6e66b9 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -54,7 +54,7 @@ sub usage {
     --[no-]bcc              <str>  * Email Bcc:
     --subject               <str>  * Email "Subject:"
     --in-reply-to           <str>  * Email "In-Reply-To:"
-    --[no-]xmailer                 * Don't add "X-Mailer:" header.  Default on.
+    --[no-]xmailer                 * Add "X-Mailer:" header (default).
     --[no-]annotate                * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
     --compose-encoding      <str>  * Encoding to assume for introduction.
@@ -177,8 +177,7 @@ sub format_2822_time {
 my $multiedit;
 my $editor;
 
-# Usage of X-Mailer email header
-my $xmailer;
+my $use_xmailer;
 
 sub do_edit {
 	if (!defined($editor)) {
@@ -224,7 +223,7 @@ sub do_edit {
     "validate" => [\$validate, 1],
     "multiedit" => [\$multiedit, undef],
     "annotate" => [\$annotate, undef],
-    "xmailer" => [\$xmailer, 1]
+    "xmailer" => [\$use_xmailer, 1]
 );
 
 my %config_settings = (
@@ -323,7 +322,7 @@ sub signal_handler {
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
 		    "compose-encoding=s" => \$compose_encoding,
 		    "force" => \$force,
-		    "xmailer!" => \$xmailer,
+		    "xmailer!" => \$use_xmailer,
 	 );
 
 usage() if $help;
@@ -1170,7 +1169,7 @@ sub send_message {
 Date: $date
 Message-Id: $message_id
 ";
-	if ($xmailer) {
+	if ($use_xmailer) {
 		$header .= "X-Mailer: git-send-email $gitversion\n";
 	}
 	if ($reply_to) {
-- 
2.2.0-141-gd3f4719

^ permalink raw reply related	[relevance 53%]

* Re: [PATCH 4/4] Add a basic test case for git send-email, and fix some real bugs discovered.
  @ 2006-05-30  6:45 53%         ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2006-05-30  6:45 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: git

Junio C Hamano <junkio@cox.net> writes:

>> 64ea8c0210c2e9d1711a870460eca326778a4ffc
>>  t/t9001-send-email.sh |   34 ++++++++++++++++++++++++++++++++++
>>  1 files changed, 34 insertions(+), 0 deletions(-)
>>  create mode 100755 t/t9001-send-email.sh
>
> Adds test, alright, but I do not see the fix.  Is this a thinko?

On top of yours, I think this covers the CC: trouble your test
triggers.

-- >8 -
send-email: fix cc address fed to underlying sendmail

---
diff --git a/git-send-email.perl b/git-send-email.perl
index d418d6c..d61ef8e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -448,9 +448,11 @@ foreach my $t (@files) {
 					else {
 						$author_not_sender = $2;
 					}
-					printf("(mbox) Adding cc: %s from line '%s'\n",
-						$2, $_) unless $quiet;
-					push @cc, $2;
+					my $cc = extract_valid_address($2);
+					printf("(mbox) Adding cc: %s from ".
+					       "line '%s'\n",
+						$cc, $_) unless $quiet;
+					push @cc, $cc;
 				}
 
 			} else {
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

^ permalink raw reply related	[relevance 53%]

* Re: Apology/Bug report: git-send-email sends everything on Ctrl+C
  @ 2010-05-26  9:27 53%           ` Sam Vilain
  0 siblings, 0 replies; 200+ results
From: Sam Vilain @ 2010-05-26  9:27 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Sverre Rabbelier, Will Palmer, Git Mailing List

Michael J Gruber wrote:
> > > Hard to know what could have possibly stopped this from happening.
> > > PEBKAC.
> > Perhaps git can be smart and ask for confirmation for huge (>20 ?)
> > patchsets.
> to be overriden by an option "--no-villain"...
> 
> Sorry, bad joke, but couldn't resist. Feel free to pick on my name ;)

I went with the simpler and pre-existing --confirm=never :-)

Subject: [PATCH] send-email: confirm for really large patch sets

It is possible to send a lot of e-mails using quite simple user errors
with git send-email; if they were not intended this could be quite a
lot of spam.  Ask a final question if there are a lot of messages
before sending.

Signed-off-by: Sam Vilain <sam@vilain.net>
---
 untested: after what just happens there is no way I'm testing this :-)

 git-send-email.perl |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 12622fc..093b7f2 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -257,6 +257,11 @@ Administering
 Default is the value of 'sendemail.confirm' configuration value; if that
 is unspecified, default to 'auto' unless any of the suppress options
 have been specified, in which case default to 'compose'.
++
+If you are sending a very large patch sequence (more than 20 parts),
+you will be asked for a second final confirmation before anything is
+sent.  This can be suppressed by setting this configuration value to
+'never'.
 
 --dry-run::
        Do everything except actually send the emails.
diff --git a/git-send-email.perl b/git-send-email.perl
index 111c981..2775506 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1096,6 +1096,19 @@ $references = $initial_reply_to || '';
 $subject = $initial_subject;
 $message_num = 0;
 
+if ($needs_confirm ne "never" and @files > 20) {
+	$_ = ask(
+		"That's a big patch set - ".@files." parts.  "
+		."Are you sure you want to do this? ([y]es|[n]o): ",
+		valid_re => qr/^(?:yes|y|no|n)/i,
+		default => "n",
+	       );
+	if (/^n/i) {
+		cleanup_compose_files();
+		exit(0);
+	}
+}
+
 foreach my $t (@files) {
 	open(F,"<",$t) or die "can't open file $t";
 
-- 
1.7.1.rc2.333.gb2668

^ permalink raw reply related	[relevance 53%]

* [PATCH 2/2] git-send-email: configurable bcc and chain-reply-to
  @ 2007-03-11 17:19 53% ` Avi Kivity
  0 siblings, 0 replies; 200+ results
From: Avi Kivity @ 2007-03-11 17:19 UTC (permalink / raw)
  To: git, Ryan Anderson; +Cc: Avi Kivity

Chain-reply-to is a personal perference, and is unlikely to change from
patchset to patchset.  Similarly, bcc is likely to have the same values
every invocation is one likes to bcc oneself.

So, allow both to be set via configuration variables.

Signed-off-by: Avi Kivity <avi@qumranet.com>
---
 Documentation/git-send-email.txt |   10 +++++++++-
 git-send-email.perl              |   10 ++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 367646e..9b3aabb 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -40,7 +40,8 @@ The --cc option must be repeated for each user you want on the cc list.
 	the first will be sent as replies to the first email sent.  When using
 	this, it is recommended that the first file given be an overview of the
 	entire patch series.
-	Default is --chain-reply-to
+	Default is the value of the 'sendemail.chainreplyto' configuration
+	value; if that is unspecified, default to --chain-reply-to.
 
 --compose::
 	Use $EDITOR to edit an introductory message for the
@@ -101,6 +102,13 @@ sendemail.aliasfiletype::
 	Format of the file(s) specified in sendemail.aliasesfile. Must be
 	one of 'mutt', 'mailrc', 'pine', or 'gnus'.
 
+sendemail.bcc::
+	Email address (or alias) to always bcc.
+
+sendemail.chainreplyto::
+	Boolean value specifying the default to the '--chain_reply_to'
+	parameter.
+
 sendemail.smtpserver::
 	Default smtp server to use.
 
diff --git a/git-send-email.perl b/git-send-email.perl
index a71a192..6989c02 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -149,6 +149,16 @@ if ($@) {
 	$term = new FakeTerm "$@: going non-interactive";
 }
 
+my $def_chain = $repo->config_boolean('sendemail.chainreplyto');
+if ($def_chain and $def_chain eq 'false') {
+    $chain_reply_to = 0;
+}
+
+@bcclist = $repo->config('sendemail.bcc');
+if (!@bcclist or !$bcclist[0]) {
+    @bcclist = ();
+}
+
 # Begin by accumulating all the variables (defined above), that we will end up
 # needing, first, from the command line:
 
-- 
1.5.0.2

^ permalink raw reply related	[relevance 53%]

* [PATCH v6 2/2] send-email: expose header information to git-send-email's sendemail-validate hook
  @ 2023-01-17  1:39 53% ` Strawbridge, Michael
  0 siblings, 0 replies; 200+ results
From: Strawbridge, Michael @ 2023-01-17  1:39 UTC (permalink / raw)
  To: git@vger.kernel.org; +Cc: Strawbridge, Michael, Tuikov, Luben, Junio C Hamano

To allow further flexibility in the git hook, the SMTP header
information of the email that git-send-email intends to send, is now
passed as a 2nd argument to the sendemail-validate hook.

As an example, this can be useful for acting upon keywords in the
subject or specific email addresses.

Cc: Luben Tuikov <luben.tuikov@amd.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Strawbridge <michael.strawbridge@amd.com>
---
 Documentation/githooks.txt | 29 +++++++++++++++++++----
 git-send-email.perl        | 31 +++++++++++++++++--------
 t/t9001-send-email.sh      | 47 ++++++++++++++++++++++++++++++++++++--
 3 files changed, 91 insertions(+), 16 deletions(-)

diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index a16e62bc8c..e80f481efd 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -583,10 +583,31 @@ processed by rebase.
 sendemail-validate
 ~~~~~~~~~~~~~~~~~~
 
-This hook is invoked by linkgit:git-send-email[1].  It takes a single parameter,
-the name of the file that holds the e-mail to be sent.  Exiting with a
-non-zero status causes `git send-email` to abort before sending any
-e-mails.
+This hook is invoked by linkgit:git-send-email[1].
+
+It takes these command line arguments:
+1. the name of the file that holds the e-mail to be sent.
+2. the name of the file that holds the SMTP headers to be used.
+
+The SMTP headers will be passed to the hook in the below format.
+Take notice of the capitalization and multi-line tab structure.
+
+  From: Example <from@example.com>
+  To: to@example.com
+  Cc: cc@example.com,
+	  A <author@example.com>,
+	  One <one@example.com>,
+	  two@example.com
+  Subject: PATCH-STRING
+  Date: DATE-STRING
+  Message-Id: MESSAGE-ID-STRING
+  X-Mailer: X-MAILER-STRING
+  Reply-To: Reply <reply@example.com>
+  MIME-Version: 1.0
+  Content-Transfer-Encoding: quoted-printable
+
+Exiting with a non-zero status causes `git send-email` to abort
+before sending any e-mails.
 
 fsmonitor-watchman
 ~~~~~~~~~~~~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 810dd1f1ce..b2adca515e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -787,14 +787,6 @@ sub is_format_patch_arg {
 
 @files = handle_backup_files(@files);
 
-if ($validate) {
-	foreach my $f (@files) {
-		unless (-p $f) {
-			validate_patch($f, $target_xfer_encoding);
-		}
-	}
-}
-
 if (@files) {
 	unless ($quiet) {
 		print $_,"\n" for (@files);
@@ -1738,6 +1730,16 @@ sub send_message {
 	return 1;
 }
 
+if ($validate) {
+	foreach my $f (@files) {
+		unless (-p $f) {
+		        pre_process_file($f, 1);
+
+			validate_patch($f, $target_xfer_encoding);
+		}
+	}
+}
+
 $in_reply_to = $initial_in_reply_to;
 $references = $initial_in_reply_to || '';
 $message_num = 0;
@@ -2101,11 +2103,20 @@ sub validate_patch {
 			chdir($repo->wc_path() or $repo->repo_path())
 				or die("chdir: $!");
 			local $ENV{"GIT_DIR"} = $repo->repo_path();
+
+			my ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header) = gen_header();
+
+			require File::Temp;
+			my ($header_filehandle, $header_filename) = File::Temp::tempfile(
+                            ".gitsendemail.header.XXXXXX", DIR => $repo->repo_path());
+			print $header_filehandle $header;
+
 			my @cmd = ("git", "hook", "run", "--ignore-missing",
 				    $hook_name, "--");
-			my @cmd_msg = (@cmd, "<patch>");
-			my @cmd_run = (@cmd, $target);
+			my @cmd_msg = (@cmd, "<patch>", "<header>");
+			my @cmd_run = (@cmd, $target, $header_filename);
 			$hook_error = system_or_msg(\@cmd_run, undef, "@cmd_msg");
+			unlink($header_filehandle);
 			chdir($cwd_save) or die("chdir: $!");
 		}
 		if ($hook_error) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1130ef21b3..346ff1463e 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -540,7 +540,7 @@ test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
 	test_path_is_file my-hooks.ran &&
 	cat >expect <<-EOF &&
 	fatal: longline.patch: rejected by sendemail-validate hook
-	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
 	warning: no patches were sent
 	EOF
 	test_cmp expect actual
@@ -559,12 +559,55 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
 	test_path_is_file my-hooks.ran &&
 	cat >expect <<-EOF &&
 	fatal: longline.patch: rejected by sendemail-validate hook
-	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
 	warning: no patches were sent
 	EOF
 	test_cmp expect actual
 '
 
+test_expect_success $PREREQ 'setup expect' "
+cat >expected-headers <<\EOF
+From: Example <from@example.com>
+To: to@example.com
+Cc: cc@example.com,
+	A <author@example.com>,
+	One <one@example.com>,
+	two@example.com
+Subject: [PATCH 1/1] Second.
+Date: DATE-STRING
+Message-Id: MESSAGE-ID-STRING
+X-Mailer: X-MAILER-STRING
+Reply-To: Reply <reply@example.com>
+MIME-Version: 1.0
+Content-Transfer-Encoding: quoted-printable
+EOF
+"
+
+test_expect_success $PREREQ "--validate hook supports header argument" '
+	write_script my-hooks/sendemail-validate <<-\EOF &&
+	if test -s "$2"
+	then
+		cat "$2" >actual
+		exit 1
+	fi
+	EOF
+	test_config core.hooksPath "my-hooks" &&
+	test_must_fail git send-email \
+		--dry-run \
+		--suppress-cc=sob \
+		--from="Example <from@example.com>" \
+		--reply-to="Reply <reply@example.com>" \
+		--to=to@example.com \
+		--cc=cc@example.com \
+		--bcc=bcc@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		--validate \
+		longline.patch &&
+	cat actual | replace_variable_fields \
+	>actual-headers &&
+	test_cmp expected-headers actual-headers
+'
+
 for enc in 7bit 8bit quoted-printable base64
 do
 	test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '
-- 
2.34.1

^ permalink raw reply related	[relevance 53%]

* [PATCH v7 2/2] send-email: expose header information to git-send-email's sendemail-validate hook
  @ 2023-01-17 14:27 53% ` Strawbridge, Michael
  0 siblings, 0 replies; 200+ results
From: Strawbridge, Michael @ 2023-01-17 14:27 UTC (permalink / raw)
  To: git@vger.kernel.org; +Cc: Strawbridge, Michael, Tuikov, Luben, Junio C Hamano

To allow further flexibility in the Git hook, the SMTP header
information of the email which git-send-email intends to send, is now
passed as the 2nd argument to the sendemail-validate hook.

As an example, this can be useful for acting upon keywords in the
subject or specific email addresses.

Cc: Luben Tuikov <luben.tuikov@amd.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Strawbridge <michael.strawbridge@amd.com>
---
 Documentation/githooks.txt | 28 +++++++++++++++++++++++----
 git-send-email.perl        | 31 ++++++++++++++++++++----------
 t/t9001-send-email.sh      | 39 ++++++++++++++++++++++++++++++++++++--
 3 files changed, 82 insertions(+), 16 deletions(-)

diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index a16e62bc8c..978d599be5 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -583,10 +583,30 @@ processed by rebase.
 sendemail-validate
 ~~~~~~~~~~~~~~~~~~
 
-This hook is invoked by linkgit:git-send-email[1].  It takes a single parameter,
-the name of the file that holds the e-mail to be sent.  Exiting with a
-non-zero status causes `git send-email` to abort before sending any
-e-mails.
+This hook is invoked by linkgit:git-send-email[1].
+
+It takes these command line arguments. They are,
+1. the name of the file which holds the contents of the email to be sent.
+2. The name of the file which holds the SMTP envelope and headers of the email.
+
+The SMTP envelope and headers are passed in the exact same way as they
+are passed to the user's Mail Transport Agent (MTA). In effect, the email
+given to the user's MTA, is the contents of $2 followed by the contents
+of $1.
+
+Below is an example for a few common headers. Take notice of the
+capitalization and multi-line tab structure.
+
+  From: Example <from@example.com>
+  To: to@example.com
+  Cc: cc@example.com,
+	  A <author@example.com>,
+	  One <one@example.com>,
+	  two@example.com
+  Subject: PATCH-STRING
+
+Exiting with a non-zero status causes `git send-email` to abort
+before sending any e-mails.
 
 fsmonitor-watchman
 ~~~~~~~~~~~~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 42f135a266..4f2039284e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -787,14 +787,6 @@ sub is_format_patch_arg {
 
 @files = handle_backup_files(@files);
 
-if ($validate) {
-	foreach my $f (@files) {
-		unless (-p $f) {
-			validate_patch($f, $target_xfer_encoding);
-		}
-	}
-}
-
 if (@files) {
 	unless ($quiet) {
 		print $_,"\n" for (@files);
@@ -1738,6 +1730,16 @@ sub send_message {
 	return 1;
 }
 
+if ($validate) {
+	foreach my $f (@files) {
+		unless (-p $f) {
+		        pre_process_file($f, 1);
+
+			validate_patch($f, $target_xfer_encoding);
+		}
+	}
+}
+
 $in_reply_to = $initial_in_reply_to;
 $references = $initial_in_reply_to || '';
 $message_num = 0;
@@ -2101,11 +2103,20 @@ sub validate_patch {
 			chdir($repo->wc_path() or $repo->repo_path())
 				or die("chdir: $!");
 			local $ENV{"GIT_DIR"} = $repo->repo_path();
+
+			my ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header) = gen_header();
+
+			require File::Temp;
+			my ($header_filehandle, $header_filename) = File::Temp::tempfile(
+                            ".gitsendemail.header.XXXXXX", DIR => $repo->repo_path());
+			print $header_filehandle $header;
+
 			my @cmd = ("git", "hook", "run", "--ignore-missing",
 				    $hook_name, "--");
-			my @cmd_msg = (@cmd, "<patch>");
-			my @cmd_run = (@cmd, $target);
+			my @cmd_msg = (@cmd, "<patch>", "<header>");
+			my @cmd_run = (@cmd, $target, $header_filename);
 			$hook_error = system_or_msg(\@cmd_run, undef, "@cmd_msg");
+			unlink($header_filehandle);
 			chdir($cwd_save) or die("chdir: $!");
 		}
 		if ($hook_error) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1130ef21b3..c0fcbacdaa 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -540,7 +540,7 @@ test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
 	test_path_is_file my-hooks.ran &&
 	cat >expect <<-EOF &&
 	fatal: longline.patch: rejected by sendemail-validate hook
-	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
 	warning: no patches were sent
 	EOF
 	test_cmp expect actual
@@ -559,12 +559,47 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
 	test_path_is_file my-hooks.ran &&
 	cat >expect <<-EOF &&
 	fatal: longline.patch: rejected by sendemail-validate hook
-	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
 	warning: no patches were sent
 	EOF
 	test_cmp expect actual
 '
 
+test_expect_success $PREREQ 'setup expect' "
+cat >expected-headers <<\EOF
+From: Example <from@example.com>
+To: to@example.com
+Cc: cc@example.com,
+	A <author@example.com>,
+	One <one@example.com>,
+	two@example.com
+Subject: [PATCH 1/1] Second.
+Date: DATE-STRING
+Message-Id: MESSAGE-ID-STRING
+X-Mailer: X-MAILER-STRING
+Reply-To: Reply <reply@example.com>
+MIME-Version: 1.0
+Content-Transfer-Encoding: quoted-printable
+EOF
+"
+
+test_expect_success $PREREQ "--validate hook supports header argument" '
+	write_script my-hooks/sendemail-validate <<-\EOF &&
+	grep "X-test-header: v1.0" "$2"
+	EOF
+	test_config core.hooksPath "my-hooks" &&
+	rm -fr outdir &&
+	git format-patch \
+		--add-header="X-test-header: v1.0" \
+		-n HEAD^1 -o outdir &&
+	git send-email \
+		--dry-run \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		--validate \
+		outdir/000?-*.patch
+'
+
 for enc in 7bit 8bit quoted-printable base64
 do
 	test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '
-- 
2.34.1

^ permalink raw reply related	[relevance 53%]

* [PATCH v7 3/3] send-email docs: add format-patch options
  @ 2021-10-11  4:10 53% ` Thiago Perrotta
  0 siblings, 0 replies; 200+ results
From: Thiago Perrotta @ 2021-10-11  4:10 UTC (permalink / raw)
  To: carenas, gitster, bagasdotme, avarab; +Cc: Thiago Perrotta, git

git-send-email(1) does not mention that "git format-patch" options are
accepted. Augment SYNOPSIS and DESCRIPTION to mention it.

Update git-send-email.perl USAGE to be consistent with
git-send-email(1).

Signed-off-by: Thiago Perrotta <tbperrotta@gmail.com>
---
 Documentation/git-send-email.txt | 6 ++++--
 git-send-email.perl              | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3db4eab4ba..41cd8cb424 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -9,7 +9,8 @@ git-send-email - Send a collection of patches as emails
 SYNOPSIS
 --------
 [verse]
-'git send-email' [<options>] <file|directory|rev-list options>...
+'git send-email' [<options>] <file|directory>...
+'git send-email' [<options>] <format-patch options>
 'git send-email' --dump-aliases
 
 
@@ -19,7 +20,8 @@ Takes the patches given on the command line and emails them out.
 Patches can be specified as files, directories (which will send all
 files in the directory), or directly as a revision list.  In the
 last case, any format accepted by linkgit:git-format-patch[1] can
-be passed to git send-email.
+be passed to git send-email, as well as options understood by
+linkgit:git-format-patch[1].
 
 The header of the email is configurable via command-line options.  If not
 specified on the command line, the user will be prompted with a ReadLine
diff --git a/git-send-email.perl b/git-send-email.perl
index 587e52d1d8..850c572dec 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -40,7 +40,8 @@ package main;
 
 sub usage {
 	print <<EOT;
-git send-email [options] <file | directory | rev-list options >
+git send-email' [<options>] <file|directory>
+git send-email' [<options>] <format-patch options>
 git send-email --dump-aliases
 
   Composing:
-- 
2.33.0


^ permalink raw reply related	[relevance 53%]

* [PATCH] git-send-email: Added the ability to query the number of smtp password questions
@ 2013-11-09 10:21 53% silvio
    0 siblings, 1 reply; 200+ results
From: silvio @ 2013-11-09 10:21 UTC (permalink / raw)
  To: git; +Cc: Silvio F

From: Silvio F <silvio.fricke@gmail.com>

Signed-off-by: Silvio F <silvio.fricke@gmail.com>
---
 Documentation/git-send-email.txt |  4 ++++
 git-send-email.perl              | 32 +++++++++++++++++++++-----------
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index f0e57a5..ac993d6 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -364,6 +364,10 @@ sendemail.confirm::
 	one of 'always', 'never', 'cc', 'compose', or 'auto'. See '--confirm'
 	in the previous section for the meaning of these values.
 
+sendmail.askpasswordcount::
+	Number of times the smtp password can be entered before sending mail is
+	aborted. Default is 1.
+
 EXAMPLE
 -------
 Use gmail as the smtp server
diff --git a/git-send-email.perl b/git-send-email.perl
index 3782c3b..9b2eda3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -203,6 +203,7 @@ my ($validate, $confirm);
 my (@suppress_cc);
 my ($auto_8bit_encoding);
 my ($compose_encoding);
+my ($askpasswordcount) = 1;
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -237,6 +238,7 @@ my %config_settings = (
     "from" => \$sender,
     "assume8bitencoding" => \$auto_8bit_encoding,
     "composeencoding" => \$compose_encoding,
+    "askpasswordcount" => \$askpasswordcount,
 );
 
 my %config_path_settings = (
@@ -360,6 +362,10 @@ sub read_config {
 		}
 	}
 
+	if ($askpasswordcount < 1) {
+		$askpasswordcount = 1
+	}
+
 	if (!defined $smtp_encryption) {
 		my $enc = Git::config(@repo, "$prefix.smtpencryption");
 		if (defined $enc) {
@@ -1069,17 +1075,21 @@ sub smtp_auth_maybe {
 	# TODO: Authentication may fail not because credentials were
 	# invalid but due to other reasons, in which we should not
 	# reject credentials.
-	$auth = Git::credential({
-		'protocol' => 'smtp',
-		'host' => smtp_host_string(),
-		'username' => $smtp_authuser,
-		# if there's no password, "git credential fill" will
-		# give us one, otherwise it'll just pass this one.
-		'password' => $smtp_authpass
-	}, sub {
-		my $cred = shift;
-		return !!$smtp->auth($cred->{'username'}, $cred->{'password'});
-	});
+	for my $i (1 .. $askpasswordcount) {
+		$auth = Git::credential({
+			'protocol' => 'smtp',
+			'host' => smtp_host_string(),
+			'username' => $smtp_authuser,
+			# if there's no password, "git credential fill" will
+			# give us one, otherwise it'll just pass this one.
+			'password' => $smtp_authpass
+		}, sub {
+			my $cred = shift;
+			return !!$smtp->auth($cred->{'username'}, $cred->{'password'});
+		});
+
+		last if ($auth);
+	}
 
 	return $auth;
 }
-- 
1.8.4.2

^ permalink raw reply related	[relevance 53%]

* [PATCH v8 2/2] send-email docs: add format-patch options
  @ 2021-10-25 21:27 53% ` Thiago Perrotta
  0 siblings, 0 replies; 200+ results
From: Thiago Perrotta @ 2021-10-25 21:27 UTC (permalink / raw)
  To: git, carenas, gitster, bagasdotme, avarab; +Cc: tbperrotta

git-send-email(1) does not mention that "git format-patch" options are
accepted. Augment SYNOPSIS and DESCRIPTION to mention it.

Update git-send-email.perl USAGE to be consistent with
git-send-email(1).

Signed-off-by: Thiago Perrotta <tbperrotta@gmail.com>
---
 Documentation/git-send-email.txt | 6 ++++--
 git-send-email.perl              | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3db4eab4ba..41cd8cb424 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -9,7 +9,8 @@ git-send-email - Send a collection of patches as emails
 SYNOPSIS
 --------
 [verse]
-'git send-email' [<options>] <file|directory|rev-list options>...
+'git send-email' [<options>] <file|directory>...
+'git send-email' [<options>] <format-patch options>
 'git send-email' --dump-aliases
 
 
@@ -19,7 +20,8 @@ Takes the patches given on the command line and emails them out.
 Patches can be specified as files, directories (which will send all
 files in the directory), or directly as a revision list.  In the
 last case, any format accepted by linkgit:git-format-patch[1] can
-be passed to git send-email.
+be passed to git send-email, as well as options understood by
+linkgit:git-format-patch[1].
 
 The header of the email is configurable via command-line options.  If not
 specified on the command line, the user will be prompted with a ReadLine
diff --git a/git-send-email.perl b/git-send-email.perl
index b45c7da3ab..ace2dbca1a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -40,7 +40,8 @@ package main;
 
 sub usage {
 	print <<EOT;
-git send-email [options] <file | directory | rev-list options >
+git send-email' [<options>] <file|directory>
+git send-email' [<options>] <format-patch options>
 git send-email --dump-aliases
 
   Composing:
-- 
2.33.1


^ permalink raw reply related	[relevance 53%]

* [PATCH] Make git-send-email aware of Cc: lines.
@ 2007-03-19  1:37 53% J. Bruce Fields
  0 siblings, 0 replies; 200+ results
From: J. Bruce Fields @ 2007-03-19  1:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

In the Linux kernel, for example, it's common to include Cc: lines
for cases when you want to remember to cc someone on a patch without
necessarily claiming they signed off on it.  Make git-send-email
aware of these.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
---
 Documentation/git-send-email.txt |    3 ++-
 git-send-email.perl              |    8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 35b0104..ba5f3ef 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -59,7 +59,8 @@ The --cc option must be repeated for each user you want on the cc list.
 	is not set, this will be prompted for.
 
 --no-signed-off-by-cc::
-	Do not add emails found in Signed-off-by: lines to the cc list.
+	Do not add emails found in Signed-off-by: or Cc: lines to the
+	cc list.
 
 --quiet::
 	Make git-send-email less verbose.  One line per email should be
diff --git a/git-send-email.perl b/git-send-email.perl
index a71a192..e6d81f9 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -65,8 +65,8 @@ Options:
                   Defaults to on.
 
    --no-signed-off-cc Suppress the automatic addition of email addresses
-                 that appear in a Signed-off-by: line, to the cc: list.
-		 Note: Using this option is not recommended.
+                 that appear in Signed-off-by: or Cc: lines to the cc:
+                 list.  Note: Using this option is not recommended.
 
    --smtp-server  If set, specifies the outgoing SMTP server to use.
                   Defaults to localhost.
@@ -562,8 +562,8 @@ foreach my $t (@files) {
 			}
 		} else {
 			$message .=  $_;
-			if (/^Signed-off-by: (.*)$/i && !$no_signed_off_cc) {
-				my $c = $1;
+			if (/^(Signed-off-by|Cc): (.*)$/i && !$no_signed_off_cc) {
+				my $c = $2;
 				chomp $c;
 				push @cc, $c;
 				printf("(sob) Adding cc: %s from line '%s'\n",
-- 
1.5.0.3.31.ge47c

^ permalink raw reply related	[relevance 53%]

* [RFC 7/9] send-email: Completely replace --signed-off-cc with --signed-off-by-cc
  @ 2008-09-29  5:08 53%   ` Michael Witten
  0 siblings, 0 replies; 200+ results
From: Michael Witten @ 2008-09-29  5:08 UTC (permalink / raw)
  To: git

This breaks backwards compatibility, but so what---get off your
lazy arses and remove the cruft.

Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
 Documentation/git-send-email.txt |    2 +-
 git-send-email.perl              |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 0d6ac4a..8ffe525 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -87,7 +87,7 @@ The --cc option must be repeated for each user you want on the cc list.
 
 --[no-]signed-off-by-cc::
 	If this is set, add emails found in Signed-off-by: or Cc: lines to the
-	cc list. Default is the value of 'sendemail.signedoffcc' configuration
+	cc list. Default is the value of 'sendemail.signedoffbycc' configuration
 	value; if that is unspecified, default to --signed-off-by-cc.
 
 --smtp-encryption::
diff --git a/git-send-email.perl b/git-send-email.perl
index 3467cf1..4662d28 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -144,7 +144,7 @@ if ($@) {
 my ($quiet, $dry_run) = (0, 0);
 
 # Variables with corresponding config settings
-my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
+my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
 my ($validate);
@@ -154,7 +154,7 @@ my %config_bool_settings = (
     "thread" => [\$thread, 1],
     "chainreplyto" => [\$chain_reply_to, 1],
     "suppressfrom" => [\$suppress_from, undef],
-    "signedoffcc" => [\$signed_off_cc, undef],
+    "signedoffbycc" => [\$signed_off_by_cc, undef],
     "validate" => [\$validate, 1],
 );
 
@@ -218,7 +218,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "cc-cmd=s" => \$cc_cmd,
 		    "suppress-from!" => \$suppress_from,
 		    "suppress-cc=s" => \@suppress_cc,
-		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
+		    "signed-off-by-cc!" => \$signed_off_by_cc,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
@@ -294,7 +294,7 @@ if ($suppress_cc{'all'}) {
 
 # If explicit old-style ones are specified, they trump --suppress-cc.
 $suppress_cc{'self'} = $suppress_from if defined $suppress_from;
-$suppress_cc{'sob'} = !$signed_off_cc if defined $signed_off_cc;
+$suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc;
 
 # Debugging, print out the suppressions.
 if (0) {
-- 
1.6.0.2.304.gdcf23.dirty

^ permalink raw reply related	[relevance 53%]

* [PATCH v4 1/1] Expose header information to git-send-email's sendemail-validate hook
  @ 2023-01-06 21:51 54% ` Strawbridge, Michael
  0 siblings, 0 replies; 200+ results
From: Strawbridge, Michael @ 2023-01-06 21:51 UTC (permalink / raw)
  To: git@vger.kernel.org
  Cc: Strawbridge, Michael, Tuikov, Luben, brian m . carlson

To allow further flexibility in the git hook, the smtp header
information of the email that git-send-email intends to send, is now
passed as a 2nd argument to the sendemail-validate hook.  A new t9001
test was added to test this 2nd arg and docs are also updated.

As an example, this can be useful for acting upon keywords in the
subject or specific email addresses.

Cc: Luben Tuikov <luben.tuikov@amd.com>
Cc: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Michael Strawbridge <michael.strawbridge@amd.com>
---
 Documentation/githooks.txt |  8 +++---
 git-send-email.perl        | 55 +++++++++++++++++++++++++-------------
 t/t9001-send-email.sh      | 25 +++++++++++++++++
 3 files changed, 65 insertions(+), 23 deletions(-)

diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index a16e62bc8c..346e536cbe 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -583,10 +583,10 @@ processed by rebase.
 sendemail-validate
 ~~~~~~~~~~~~~~~~~~
 
-This hook is invoked by linkgit:git-send-email[1].  It takes a single parameter,
-the name of the file that holds the e-mail to be sent.  Exiting with a
-non-zero status causes `git send-email` to abort before sending any
-e-mails.
+This hook is invoked by linkgit:git-send-email[1].  It takes two parameters,
+the name of a file that holds the patch and the name of a file that holds the
+SMTP headers.  Exiting with a non-zero status causes `git send-email` to abort
+before sending any e-mails.
 
 fsmonitor-watchman
 ~~~~~~~~~~~~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 5861e99a6e..5a626a4238 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -787,14 +787,6 @@ sub is_format_patch_arg {
 
 @files = handle_backup_files(@files);
 
-if ($validate) {
-	foreach my $f (@files) {
-		unless (-p $f) {
-			validate_patch($f, $target_xfer_encoding);
-		}
-	}
-}
-
 if (@files) {
 	unless ($quiet) {
 		print $_,"\n" for (@files);
@@ -1495,16 +1487,7 @@ sub file_name_is_absolute {
 	return File::Spec::Functions::file_name_is_absolute($path);
 }
 
-# Prepares the email, then asks the user what to do.
-#
-# If the user chooses to send the email, it's sent and 1 is returned.
-# If the user chooses not to send the email, 0 is returned.
-# If the user decides they want to make further edits, -1 is returned and the
-# caller is expected to call send_message again after the edits are performed.
-#
-# If an error occurs sending the email, this just dies.
-
-sub send_message {
+sub gen_header {
 	my @recipients = unique_email_list(@to);
 	@cc = (grep { my $cc = extract_valid_address_or_die($_);
 		      not grep { $cc eq $_ || $_ =~ /<\Q${cc}\E>$/ } @recipients
@@ -1546,6 +1529,22 @@ sub send_message {
 	if (@xh) {
 		$header .= join("\n", @xh) . "\n";
 	}
+	my $recipients_ref = \@recipients;
+	return ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header);
+}
+
+# Prepares the email, then asks the user what to do.
+#
+# If the user chooses to send the email, it's sent and 1 is returned.
+# If the user chooses not to send the email, 0 is returned.
+# If the user decides they want to make further edits, -1 is returned and the
+# caller is expected to call send_message again after the edits are performed.
+#
+# If an error occurs sending the email, this just dies.
+
+sub send_message {
+	my ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header) = gen_header();
+	my @recipients = @$recipients_ref;
 
 	my @sendmail_parameters = ('-i', @recipients);
 	my $raw_from = $sender;
@@ -1955,6 +1954,15 @@ sub process_file {
 		}
 	}
 
+
+	if ($validate) {
+		foreach my $f (@files) {
+			unless (-p $f) {
+				validate_patch($f, $target_xfer_encoding);
+			}
+		}
+	}
+
 	my $message_was_sent = send_message();
 	if ($message_was_sent == -1) {
 		do_edit($t);
@@ -2088,11 +2096,20 @@ sub validate_patch {
 			chdir($repo->wc_path() or $repo->repo_path())
 				or die("chdir: $!");
 			local $ENV{"GIT_DIR"} = $repo->repo_path();
+
+			my ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header) = gen_header();
+
+			require File::Temp;
+			my ($header_filehandle, $header_filename) = File::Temp::tempfile(
+                            ".gitsendemail.header.XXXXXX", DIR => $repo->repo_path());
+			print $header_filehandle $header;
+
 			my @cmd = ("git", "hook", "run", "--ignore-missing",
 				    $hook_name, "--");
 			my @cmd_msg = (@cmd, "<patch>");
-			my @cmd_run = (@cmd, $target);
+			my @cmd_run = (@cmd, $target, $header_filename);
 			$hook_error = system_or_msg(\@cmd_run, undef, "@cmd_msg");
+			unlink($header_filehandle);
 			chdir($cwd_save) or die("chdir: $!");
 		}
 		if ($hook_error) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1130ef21b3..11e68f9c18 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -565,6 +565,31 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
 	test_cmp expect actual
 '
 
+test_expect_success $PREREQ "--validate hook supports header argument" '
+	test_when_finished "rm my-hooks.ran" &&
+	write_script my-hooks/sendemail-validate <<-\EOF &&
+	filesize=$(stat -c%s "$2")
+	if [ "$filesize" != "0" ]; then
+	>my-hooks.ran
+	fi
+	exit 1
+	EOF
+	test_config core.hooksPath "my-hooks" &&
+	test_must_fail git send-email \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		--validate \
+		longline.patch 2>actual &&
+	test_path_is_file my-hooks.ran &&
+	cat >expect <<-EOF &&
+	fatal: longline.patch: rejected by sendemail-validate hook
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+	warning: no patches were sent
+	EOF
+	test_cmp expect actual
+'
+
 for enc in 7bit 8bit quoted-printable base64
 do
 	test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '
-- 
2.34.1

^ permalink raw reply related	[relevance 54%]

* [PATCH] git-send-email: Add --suppress-cc all
  @ 2007-12-24 21:26 54%     ` David Brown
  0 siblings, 0 replies; 200+ results
From: David Brown @ 2007-12-24 21:26 UTC (permalink / raw)
  To: Joel Becker; +Cc: git

Add the 'all' option to --suppress-cc, allowing easier suppression of
everything.

Signed-off-by: David Brown <git@davidb.org>
---
On Mon, Dec 24, 2007 at 01:03:25PM -0800, Joel Becker wrote:

>+   all    - all of the above, thus only honoring '--to', '--cc', and
>             '--bcc'

I can squash this with the other patch if that would be cleaner.

Dave

  Documentation/git-send-email.txt |    2 +-
  git-send-email.perl              |   11 ++++++++++-
  2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 432f336..fdfb56e 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -125,7 +125,7 @@ The --cc option must be repeated for each user you want on the cc list.
  	avoid including the patch author, 'cc' will avoid including anyone
  	mentioned in Cc lines in the patch, 'sob' will avoid including
  	anyone mentioned in Signed-off-by lines, and 'cccmd' will avoid
-	running the --cc-cmd.
+	running the --cc-cmd.  'all' will suppress all auto cc values.
  	Default is the value of 'sendemail.suppresscc' configuration value;
  	if that is unspecified, default to 'self' if --suppress-from is
  	specified, as well as 'sob' if --no-signed-off-cc is specified.
diff --git a/git-send-email.perl b/git-send-email.perl
index cb9adf2..ef16824 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -275,7 +275,7 @@ my(%suppress_cc);
  if (@suppress_cc) {
  	foreach my $entry (@suppress_cc) {
  		die "Unknown --suppress-cc field: '$entry'\n"
-			unless $entry =~ /^(cccmd|cc|author|self|sob)$/;
+			unless $entry =~ /^(all|cccmd|cc|author|self|sob)$/;
  		$suppress_cc{$entry} = 1;
  	}
  } else {
@@ -284,6 +284,15 @@ if (@suppress_cc) {
  	$suppress_cc{'sob'} = 1 unless $signed_off_cc;
  }
  
+if ($suppress_cc{'all'}) {
+	foreach my $entry (qw (ccmd cc author self sob)) {
+		$suppress_cc{$entry} = 1;
+	}
+	delete $suppress_cc{'all'};
+}
+
+printf "Suppressions: %s\n", join(',', keys(%suppress_cc));
+
  my ($repoauthor) = $repo->ident_person('author');
  my ($repocommitter) = $repo->ident_person('committer');
  
-- 
1.5.3.7

^ permalink raw reply related	[relevance 54%]

* [PATCH 2/2] send-email: Add --cc
  @ 2006-02-13  8:22 54% ` Ryan Anderson
  0 siblings, 0 replies; 200+ results
From: Ryan Anderson @ 2006-02-13  8:22 UTC (permalink / raw)
  To: Junio C Hamano, git; +Cc: Ryan Anderson

Since Junio used this in an example, and I've personally tried to use it, I
suppose the option should actually exist.

Signed-off-by: Ryan Anderson <ryan@michonline.com>

---

 Documentation/git-send-email.txt |    3 +++
 git-send-email.perl              |    8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

6d18725b9d46259162cfe54c9e0e369558394816
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index c2f52f5..8c58685 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -24,6 +24,9 @@ OPTIONS
 -------
 The options available are:
 
+--cc::
+	Specify a starting "Cc:" value for each email.
+
 --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
diff --git a/git-send-email.perl b/git-send-email.perl
index abffca5..13b85dd 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -31,7 +31,7 @@ sub cleanup_compose_files();
 my $compose_filename = ".msg.$$";
 
 # Variables we fill in automatically, or via prompting:
-my (@to,@cc,$initial_reply_to,$initial_subject,@files,$from,$compose);
+my (@to,@cc,@initial_cc,$initial_reply_to,$initial_subject,@files,$from,$compose);
 
 # Behavior modification variables
 my ($chain_reply_to, $smtp_server, $quiet, $suppress_from, $no_signed_off_cc) = (1, "localhost", 0, 0, 0);
@@ -48,6 +48,7 @@ my $rc = GetOptions("from=s" => \$from,
                     "in-reply-to=s" => \$initial_reply_to,
 		    "subject=s" => \$initial_subject,
 		    "to=s" => \@to,
+		    "cc=s" => \@initial_cc,
 		    "chain-reply-to!" => \$chain_reply_to,
 		    "smtp-server=s" => \$smtp_server,
 		    "compose" => \$compose,
@@ -199,6 +200,9 @@ Options:
 
    --to           Specify the primary "To:" line of the email.
 
+   --cc           Specify an initial "Cc:" list for the entire series
+                  of emails.
+
    --compose      Use \$EDITOR to edit an introductory message for the
                   patch series.
 
@@ -298,7 +302,7 @@ $subject = $initial_subject;
 foreach my $t (@files) {
 	open(F,"<",$t) or die "can't open file $t";
 
-	@cc = ();
+	@cc = @initial_cc;
 	my $found_mbox = 0;
 	my $header_done = 0;
 	$message = "";
-- 
1.2.0.g6d18

^ permalink raw reply related	[relevance 54%]

* [PATCH 2/3] send-email: accept long lines with suitable transfer encoding
  @ 2018-07-06  2:23 54% ` brian m. carlson
    1 sibling, 0 replies; 200+ results
From: brian m. carlson @ 2018-07-06  2:23 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan, Junio C Hamano, Drew DeVault

With --validate (which is the default), we warn about lines exceeding
998 characters due to the limits specified in RFC 5321.  However, if
we're using a suitable transfer encoding (quoted-printable or base64),
we're guaranteed not to have lines exceeding 76 characters, so there's
no need to fail in this case.  The auto transfer encoding handles this
specific case, so accept it as well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 Documentation/git-send-email.txt |  5 +++--
 git-send-email.perl              |  8 ++++++--
 t/t9001-send-email.sh            | 13 +++++++++++++
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 385c7de9e2..f44fb4b81e 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -401,8 +401,9 @@ have been specified, in which case default to 'compose'.
 +
 --
 		*	Invoke the sendemail-validate hook if present (see linkgit:githooks[5]).
-		*	Warn of patches that contain lines longer than 998 characters; this
-			is due to SMTP limits as described by http://www.ietf.org/rfc/rfc2821.txt.
+		*	Warn of patches that contain lines longer than 998 characters unless
+			a suitable transfer encoding is used; this is due to SMTP limits as
+			described by http://www.ietf.org/rfc/rfc2821.txt.
 --
 +
 Default is the value of `sendemail.validate`; if this is not set,
diff --git a/git-send-email.perl b/git-send-email.perl
index a76953c310..4ea30c4070 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -645,7 +645,7 @@ sub is_format_patch_arg {
 if ($validate) {
 	foreach my $f (@files) {
 		unless (-p $f) {
-			my $error = validate_patch($f);
+			my $error = validate_patch($f, $target_xfer_encoding);
 			$error and die sprintf(__("fatal: %s: %s\nwarning: no patches were sent\n"),
 						  $f, $error);
 		}
@@ -1879,7 +1879,7 @@ sub unique_email_list {
 }
 
 sub validate_patch {
-	my $fn = shift;
+	my ($fn, $xfer_encoding) = @_;
 
 	if ($repo) {
 		my $validate_hook = catfile(catdir($repo->repo_path(), 'hooks'),
@@ -1899,6 +1899,10 @@ sub validate_patch {
 		return $hook_error if $hook_error;
 	}
 
+	# Any long lines will be automatically fixed if we use a suitable transfer
+	# encoding.
+	return if $xfer_encoding =~ /^(?:auto|quoted-printable|base64)$/;
+
 	open(my $fh, '<', $fn)
 		or die sprintf(__("unable to open %s: %s\n"), $fn, $!);
 	while (my $line = <$fh>) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 6cdcbcb19e..6a0ace386b 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -480,6 +480,19 @@ test_expect_success $PREREQ 'long lines with auto encoding are quoted-printable'
 	grep "Content-Transfer-Encoding: quoted-printable" msgtxt1
 '
 
+test_expect_success $PREREQ '--validate passes with certain encodings' '
+	for enc in auto quoted-printable base64
+	do
+		git send-email \
+			--from="Example <nobody@example.com>" \
+			--to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--transfer-encoding=$enc \
+			--validate \
+			$patches longline.patch
+	done
+'
+
 test_expect_success $PREREQ 'Invalid In-Reply-To' '
 	clean_fake_sendmail &&
 	git send-email \

^ permalink raw reply related	[relevance 54%]

* [PATCH v2] git-send-email: Respect core.hooksPath setting
@ 2021-03-23 16:27 54% Robert Foss
  0 siblings, 0 replies; 200+ results
From: Robert Foss @ 2021-03-23 16:27 UTC (permalink / raw)
  To: Junio C Hamano, git, Ævar Arnfjörð Bjarmason
  Cc: Drew DeVault, Rafael Aquini, Marcelo Arenas Belón,
	Robert Foss

get-send-email currently makes the assumption that the
'sendemail-validate' hook exists inside of the repository.

Since the introduction of 'core.hooksPath' configuration option in
v2.9, this is no longer true.

Instead of assuming a hardcoded repo relative path, query
git for the actual path of the hooks directory.

Signed-off-by: Robert Foss <robert.foss@linaro.org>
---

Changes since v1:
 - Ævar: Add unit test
 - Ævar: Add support for getting the hooks_path() from Git perl module
 - Ævar: Use new hooks_path() instread of issuing git rev-parse in
         git-send-email.perl


Note: The test currently leaves a file in a mktemp directory
in /tmp.

 git-send-email.perl   |  4 ++--
 perl/Git.pm           |  9 +++++++++
 t/t9001-send-email.sh | 16 ++++++++++++++++
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 1f425c0809..c3dd825322 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1942,8 +1942,8 @@ sub validate_patch {
 	my ($fn, $xfer_encoding) = @_;
 
 	if ($repo) {
-		my $validate_hook = catfile(catdir($repo->repo_path(), 'hooks'),
-					    'sendemail-validate');
+		my $hook_path = $repo->hooks_path();
+		my $validate_hook = catfile($hook_path, 'sendemail-validate');
 		my $hook_error;
 		if (-x $validate_hook) {
 			my $target = abs_path($fn);
diff --git a/perl/Git.pm b/perl/Git.pm
index 02eacef0c2..ac1fabff28 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -226,6 +226,8 @@ sub repository {
 			$opts{Repository} = abs_path($dir);
 		}
 
+                $opts{HooksPath} = $search->command_oneline('rev-parse', '--git-path', 'hooks');
+
 		delete $opts{Directory};
 	}
 
@@ -619,6 +621,13 @@ sub _prompt {
 
 sub repo_path { $_[0]->{opts}->{Repository} }
 
+=item hooks_path ()
+
+Return path to the hooks directory. Must be called on a repository instance.
+
+=cut
+
+sub hooks_path { $_[0]->{opts}->{HooksPath} }
 
 =item wc_path ()
 
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 4eee9c3dcb..73b3bc1ce6 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -513,6 +513,22 @@ do
 
 done
 
+test_expect_success $PREREQ "--validate respects core.hooksPath setting" '
+	clean_fake_sendmail &&
+	tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) &&
+	printf "#!/bin/sh" >> $tmp_dir/sendemail-validate &&
+	printf "return 1" >> $tmp_dir/sendemail-validate &&
+	chmod a+x $tmp_dir/sendemail-validate &&
+	git -c core.hooksPath=$tmp_dir send-email \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		--validate \
+		longline.patch \
+		2>&1 >/dev/null | \
+	grep "rejected by sendemail-validate"
+'
+
 for enc in 7bit 8bit quoted-printable base64
 do
 	test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '
-- 
2.31.0.30.g398dba342d.dirty


^ permalink raw reply related	[relevance 54%]

* [PATCH] send-email: automatic envelope sender
@ 2009-11-26 19:04 54% Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2009-11-26 19:04 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Felipe Contreras

This adds the option to specify the envelope sender as "auto" which
would pick the 'from' address. This is good because now we can specify
the address only in one place (and change it easily).

Comments by Junio C Hamano.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-send-email.txt |    7 ++++---
 git-send-email.perl              |    6 +++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index c85d7f4..8c482f4 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -108,9 +108,10 @@ Sending
 --envelope-sender=<address>::
 	Specify the envelope sender used to send the emails.
 	This is useful if your default address is not the address that is
-	subscribed to a list. If you use the sendmail binary, you must have
-	suitable privileges for the -f parameter. Default is the value of
-	the 'sendemail.envelopesender' configuration variable; if that is
+	subscribed to a list. In order to use the 'From' address, set the
+	value to "auto". If you use the sendmail binary, you must have
+	suitable privileges for the -f parameter.  Default is the value of the
+	'sendemail.envelopesender' configuration variable; if that is
 	unspecified, choosing the envelope sender is left to your MTA.
 
 --smtp-encryption=<encryption>::
diff --git a/git-send-email.perl b/git-send-email.perl
index 4f5da4e..da2e56e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -862,7 +862,11 @@ X-Mailer: git-send-email $gitversion
 
 	my @sendmail_parameters = ('-i', @recipients);
 	my $raw_from = $sanitized_sender;
-	$raw_from = $envelope_sender if (defined $envelope_sender);
+	if (defined $envelope_sender) {
+		if (not $envelope_sender eq "auto") {
+			$raw_from = $envelope_sender;
+		}
+	}
 	$raw_from = extract_valid_address($raw_from);
 	unshift (@sendmail_parameters,
 			'-f', $raw_from) if(defined $envelope_sender);
-- 
1.6.6.rc0.61.geeb75

^ permalink raw reply related	[relevance 54%]

* [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects
@ 2012-10-24  8:03 54% Krzysztof Mazur
  0 siblings, 0 replies; 200+ results
From: Krzysztof Mazur @ 2012-10-24  8:03 UTC (permalink / raw)
  To: gitster, git; +Cc: Krzysztof Mazur

The git-send-email always use RFC2047 subject quoting for files
with "broken" encoding - non-ASCII files without Content-Transfer-Encoding,
even for ASCII subjects. Now for ASCII subjects the RFC2047 quoting will be
skipped.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
---
 git-send-email.perl   |  3 ++-
 t/t9001-send-email.sh | 17 +++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index adcb4e3..efeae4c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1327,7 +1327,8 @@ foreach my $t (@files) {
 		$body_encoding = $auto_8bit_encoding;
 	}
 
-	if ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {
+	if ($broken_encoding{$t} && !is_rfc2047_quoted($subject) &&
+			($subject =~ /[^[:ascii:]]/)) {
 		$subject = quote_rfc2047($subject, $auto_8bit_encoding);
 	}
 
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 89fceda..6c6af7d 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1143,6 +1143,23 @@ EOF
 '
 
 test_expect_success $PREREQ 'setup expect' '
+cat >expected <<EOF
+Subject: subject goes here
+EOF
+'
+
+test_expect_success $PREREQ 'ASCII subject is not RFC2047 quoted' '
+	clean_fake_sendmail &&
+	echo bogus |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--8bit-encoding=UTF-8 \
+			email-using-8bit >stdout &&
+	grep "Subject" msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
+test_expect_success $PREREQ 'setup expect' '
 cat >content-type-decl <<EOF
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
-- 
1.8.0.3.gf4c35fc

^ permalink raw reply related	[relevance 54%]

* [PATCHv2] git-send-email: add ~/.authinfo parsing
  @ 2013-01-29 21:08 54% ` Michal Nazarewicz
  0 siblings, 0 replies; 200+ results
From: Michal Nazarewicz @ 2013-01-29 21:08 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Krzysztof Mazur, Michal Nazarewicz

From: Michal Nazarewicz <mina86@mina86.com>

Make git-send-email read password from a ~/.authinfo or a ~/.netrc
file instead of requiring it to be stored in git configuration, passed
as command line argument or typed in.

There are various other applications that use this file for
authentication information so letting users use it for git-send-email
is convinient.  Furthermore, some users store their ~/.gitconfig file
in a public repository and having to store password there makes it
easy to publish the password.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
---
 Documentation/git-send-email.txt |  34 +++++++++--
 git-send-email.perl              | 124 +++++++++++++++++++++++++++++++++++----
 2 files changed, 140 insertions(+), 18 deletions(-)

On Tue, Jan 29 2013, Junio C Hamano wrote:
> Makes one wonder why .authinfo and not .netrc; 

Fine… Let's parse both. ;)

> Either way it still encourages a plaintext password to be on disk,
> which may not be what we want, even though it may be slight if not
> really much of an improvement.

Well… Users store passwords on disks in a lot of places.  I wager that
most have mail clients configured not to ask for password but instead
store it on hard drive.  I don't see that changing any time soon, so
at least we can try and minimise number of places where a password is
stored.

> It is rather strange to require a comma-separated-values parser to
> read a file format this simple, isn't it?

I was worried about spaces in password.  CVS should handle such case
nicely, whereas simple split won't.  Nonetheless, I guess that in the
end this is not likely enough to add the dependency.

> Perhaps you can convert at least some popular ones yourself?  After
> all, the user may be using an _existing_ .authinfo/.netrc that she
> has been using with other programs that do understand symbolic port
> names.  Rather than forcing all such users to update their files,
> the patch can work a bit harder for them and the world will be a
> better place, no?

Parsing /etc/services added.

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index eeb561c..ee20714 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -158,14 +158,36 @@ Sending
 --smtp-pass[=<password>]::
 	Password for SMTP-AUTH. The argument is optional: If no
 	argument is specified, then the empty string is used as
-	the password. Default is the value of 'sendemail.smtppass',
-	however '--smtp-pass' always overrides this value.
+	the password. Default is the value of 'sendemail.smtppass'
+	or value read from ~/.authinfo file, however '--smtp-pass'
+	always overrides this value.
 +
-Furthermore, passwords need not be specified in configuration files
-or on the command line. If a username has been specified (with
+Furthermore, passwords need not be specified in configuration files or
+on the command line. If a username has been specified (with
 '--smtp-user' or a 'sendemail.smtpuser'), but no password has been
-specified (with '--smtp-pass' or 'sendemail.smtppass'), then the
-user is prompted for a password while the input is masked for privacy.
+specified (with '--smtp-pass', 'sendemail.smtppass' or via
+~/.authinfo file), then the user is prompted for a password while
+the input is masked for privacy.
++
+The ~/.authinfo file should contain a line with the following
+format:
++
+  machine <domain> port <port> login <user> password <pass>
++
+Each pair (expect for `password <pass>`) can be omitted which will
+skip matching of the given value.  Lines are interpreted in order and
+password from the first line that matches will be used.  `<port>` can
+be either an integer or a symbolic name.  In the latter case, it is
+looked up in `/etc/services` file (if it exists).  For instance, you
+can put
++
+  machine example.com login testuser port ssmtp password smtppassword
+  machine example.com login testuser            password testpassword
++
+if you want to use `smtppassword` for authenticating to a service at
+port 465 (SSMTP) and `testpassword` for all other services.  As shown
+in the example, `<port>` can use   If ~/.authinfo file is
+missing, 'git-send-email' will also try ~/.netrc file.
 
 --smtp-server=<host>::
 	If set, specifies the outgoing SMTP server to use (e.g.
diff --git a/git-send-email.perl b/git-send-email.perl
index be809e5..2d8fd1b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1045,6 +1045,117 @@ sub maildomain {
 	return maildomain_net() || maildomain_mta() || 'localhost.localdomain';
 }
 
+
+sub read_password_from_stdin {
+	my $line;
+
+	system "stty -echo";
+
+	do {
+		print "Password: ";
+		$line = <STDIN>;
+		print "\n";
+	} while (!defined $line);
+
+	system "stty echo";
+
+	chomp $line;
+	return $line;
+}
+
+sub read_etc_services {
+	my $fd;
+	if (!open $fd, '<', '/etc/services') {
+		return {};
+	}
+
+	my $ret = {};
+	while (my $line = <$fd>) {
+		$line =~ s/^\s+|\s*(?:#.*)?$//g;
+		my @line = split /\s+/, $line;
+		if (@line < 2 || $line[1] !~ m~^(\d+)/tcp$~) {
+			next;
+		}
+
+		my $num = int $1;
+		undef $line[1];
+		for my $service (@line) {
+			if (defined $service && !defined $ret->{$service}) {
+				$ret->{$service} = $num;
+			}
+		}
+	}
+
+	close $fd;
+	return $ret;
+}
+
+my $authinfo_parse_port;
+
+sub authinfo_is_eq_port {
+	my ($from_file, $value, $filename) = @_;
+
+	if (!defined $from_file) {
+		return 1;
+	} elsif ($from_file =~ /^\d+$/) {
+		return $from_file == $value;
+	}
+
+	if (!defined $authinfo_parse_port) {
+		$authinfo_parse_port = read_etc_services;
+	}
+
+	my $port = $authinfo_parse_port->{$from_file};
+	if (!defined $port) {
+		print STDERR "$filename: invalid port name: $from_file\n";
+		return;
+	}
+
+	return $port == $value;
+}
+
+sub authinfo_is_eq {
+	my ($from_file, $value) = @_;
+	return defined $from_file || $from_file eq $value;
+}
+
+sub read_password_from_authinfo {
+	my $filename = join '/', $ENV{'HOME'}, $_[0] // '.authinfo';
+	my $fd;
+	if (!open $fd, '<', $filename) {
+		return;
+	}
+
+	my $password;
+	while (my $line = <$fd>) {
+		$line =~ s/^\s+|\s+$//g;
+		my @line = split /\s+/, $line;
+		if (@line % 2) {
+			next;
+		}
+
+		my %line = @line;
+		if (defined $line{'password'} &&
+		    authinfo_is_eq $line{'machine'}, $smtp_server &&
+		    authinfo_is_eq $line{'login'}, $smtp_authuser &&
+		    authinfo_is_eq_port $line{'port'}, $smtp_server_port, $filename) {
+			$password = $line{'password'};
+			last;
+		}
+	}
+
+	close $fd;
+	return $password;
+}
+
+sub read_password {
+	return
+	  read_password_from_authinfo '.authinfo' ||
+	  read_password_from_authinfo '.netrc' ||
+	  read_password_from_stdin;
+}
+
+
 # Returns 1 if the message was sent, and 0 otherwise.
 # In actuality, the whole program dies when there
 # is an error sending a message.
@@ -1194,18 +1305,7 @@ X-Mailer: git-send-email $gitversion
 			};
 
 			if (!defined $smtp_authpass) {
-
-				system "stty -echo";
-
-				do {
-					print "Password: ";
-					$_ = <STDIN>;
-					print "\n";
-				} while (!defined $_);
-
-				chomp($smtp_authpass = $_);
-
-				system "stty echo";
+				$smtp_authpass = read_password
 			}
 
 			$auth ||= $smtp->auth( $smtp_authuser, $smtp_authpass ) or die $smtp->message;
-- 
1.8.1

^ permalink raw reply related	[relevance 54%]

* [PATCH] send-email: add 'specify-author' option
@ 2011-02-06 14:44 54% Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2011-02-06 14:44 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

From: Felipe Contreras <felipe.contreras@gmail.com>

Always specify the author of the commit in the body of the message, even
if the committer is the author.

This is useful if the 'From' header is mangled by some mail server.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-send-email.txt |    4 ++++
 git-send-email.perl              |    7 ++++++-
 t/t9001-send-email.sh            |   12 ++++++++++++
 3 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 7ec9dab..5895835 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -125,6 +125,10 @@ The --to option must be repeated for each user you want on the to list.
 +
 Note that no attempts whatsoever are made to validate the encoding.
 
+--specify-author::
+	Always specify the author of the commit in the body of the message,
+	even if the committer is the author. This is useful if the 'From'
+	header is mangled by some mail server.
 
 Sending
 ~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 76565de..30f27ff 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -57,6 +57,8 @@ git send-email [options] <file | directory | rev-list options >
     --annotate                     * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
     --8bit-encoding         <str>  * Encoding to assume 8bit mails if undeclared
+    --specify-author               * Always specify the author of the commit in
+			             the body of the message.
 
   Sending:
     --envelope-sender       <str>  * Email envelope sender.
@@ -198,6 +200,7 @@ my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
 my ($validate, $confirm);
 my (@suppress_cc);
 my ($auto_8bit_encoding);
+my ($specify_author);
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -210,6 +213,7 @@ my %config_bool_settings = (
     "signedoffbycc" => [\$signed_off_by_cc, undef],
     "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
     "validate" => [\$validate, 1],
+    "specifyauthor" => [\$specify_author, undef],
 );
 
 my %config_settings = (
@@ -311,6 +315,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "format-patch!" => \$format_patch,
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
 		    "force" => \$force,
+		    "specify-author!" => \$specify_author,
 	 );
 
 unless ($rc) {
@@ -1285,7 +1290,7 @@ foreach my $t (@files) {
 		$subject = quote_rfc2047($subject, $auto_8bit_encoding);
 	}
 
-	if (defined $author and $author ne $sender) {
+	if (defined $author and ($author ne $sender or $specify_author)) {
 		$message = "From: $author\n\n$message";
 		if (defined $author_encoding) {
 			if ($has_content_type) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 579ddb7..66d2541 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -280,6 +280,18 @@ test_expect_success $PREREQ 'Author From: not in message body' '
 	! grep "From: A <author@example.com>" msgbody1
 '
 
+test_expect_success $PREREQ 'Author From: in message body (forced)' '
+	clean_fake_sendmail &&
+	git send-email \
+		--from="A <author@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		--specify-author \
+		$patches &&
+	sed "1,/^\$/d" < msgtxt1 > msgbody1 &&
+	grep "From: A <author@example.com>" msgbody1
+'
+
 test_expect_success $PREREQ 'allow long lines with --no-validate' '
 	git send-email \
 		--from="Example <nobody@example.com>" \
-- 
1.7.4.1.gf4271.dirty

^ permalink raw reply related	[relevance 54%]

* Re: [PATCH v2 1/2] sendemail: teach git-send-email to list aliases
  @ 2015-11-17  7:20 54%         ` Eric Sunshine
  0 siblings, 0 replies; 200+ results
From: Eric Sunshine @ 2015-11-17  7:20 UTC (permalink / raw)
  To: Keller, Jacob E
  Cc: git@vger.kernel.org, gitster@pobox.com, spearce@spearce.org,
	lee.marlow@gmail.com, felipe.contreras@gmail.com,
	szeder@ira.uka.de, jacob.keller@gmail.com

On Tue, Nov 17, 2015 at 12:10:35AM +0000, Keller, Jacob E wrote:
> On Mon, 2015-11-16 at 18:50 -0500, Eric Sunshine wrote:
> > It should be possible to extract the alias within the shell itself
> > without a separate process. For instance:
> > 
> >     read alias rest
> > 
> > will leave the first token in $alias and the remainder of the line in
> > $rest, and it's all done within the shell process.
> 
> I'll look into this :)

My reason for asking is concern about scripts possibly breaking if
someone comes along and wants to "fix" --dump-aliases to also dump
the alias expansions. One possibility is just to punt today and say
that when that feature is needed in the future, then that someone can
add a --verbose option to complement --dump-aliases which would emit
the alias expansions as well. One nice thing about punting at this
point is that we don't (today) have to define a format for the output
of the expansions. If we did want to think about it, one verbose,
non-ambiguous format would be to show the alias name on a line by
itself, and each expansion value on a line by itself indented by a
tab. For instance:

    managers
        bob
	fred
    devs
        jane
	john

> > Also, shouldn't --list-aliases (or --dump-aliases) be mutually
> > exclusive with many of the other options? New tests would check such
> > exclusivity as well.
> 
> I am at a loss for how to do that correctly in the perl. Help would be
> appreciated here.

Since git-send-email.perl already configures GetOpt::Long with the
'pass_through' option, one possibility would be to invoke
GetOptions() once for --list-aliases (or --dump-aliases), and then
again for the normal options. Doing so may be a bit ugly; on the
other hand, it does indicate pretty clearly that --list-aliases is a
distinct "mode" of operation. On top of your patch, it might look
something like this:

--- 8< ---
diff --git a/git-send-email.perl b/git-send-email.perl
index ee14894..cada5ea 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -296,6 +296,12 @@ $SIG{INT}  = \&signal_handler;
 
 my $help;
 my $rc = GetOptions("h" => \$help,
+		    "list-aliases" => \$list_aliases);
+usage() unless $rc;
+die "--list-aliases incompatible with other options\n"
+	if !$help and $list_aliases and @ARGV;
+
+$rc = GetOptions(
 		    "sender|from=s" => \$sender,
                     "in-reply-to=s" => \$initial_reply_to,
 		    "subject=s" => \$initial_subject,
@@ -349,7 +355,6 @@ my $rc = GetOptions("h" => \$help,
 		    "force" => \$force,
 		    "xmailer!" => \$use_xmailer,
 		    "no-xmailer" => sub {$use_xmailer = 0},
-                    "list-aliases" => \$list_aliases,
 	 );
 
 usage() if $help;
--- 8< ---

Though, it may be overkill for this minor use-case.

^ permalink raw reply related	[relevance 54%]

* [PATCH 3/8] git-send-email.perl: Handle shell metacharacters in $EDITOR properly
  @ 2008-04-09  1:29 54%     ` Bryan Donlan
  0 siblings, 0 replies; 200+ results
From: Bryan Donlan @ 2008-04-09  1:29 UTC (permalink / raw)
  To: git; +Cc: Johannes Sixt, Adam Roben, gitster, Bryan Donlan

Also, update t/t9001-send-email.sh to test for this bug.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
---
 git-send-email.perl   |    2 +-
 t/t9001-send-email.sh |    8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index be4a20d..975df1c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -510,7 +510,7 @@ EOT
 	close(C);
 
 	my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
-	system('sh', '-c', '$0 $@', $editor, $compose_filename);
+	system('sh', '-c', $editor.' $@', $editor, $compose_filename);
 
 	open(C2,">",$compose_filename . ".final")
 		or die "Failed to open $compose_filename.final : " . $!;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c0973b4..030f66c 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -139,15 +139,19 @@ test_expect_success 'Valid In-Reply-To when prompting' '
 
 test_expect_success 'setup fake editor' '
 	(echo "#!/bin/sh" &&
-	 echo "echo fake edit >>\$1"
+	 echo "echo fake edit >>\"\$1\""
 	) >fake-editor &&
 	chmod +x fake-editor
 '
 
+FAKE_EDITOR="$(pwd)/fake-editor"
+export FAKE_EDITOR
+GIT_EDITOR='"$FAKE_EDITOR"'
+export GIT_EDITOR
+
 test_expect_success '--compose works' '
 	clean_fake_sendmail &&
 	echo y | \
-		GIT_EDITOR=$(pwd)/fake-editor \
 		GIT_SEND_EMAIL_NOTTY=1 \
 		git send-email \
 		--compose --subject foo \
-- 
1.5.5.8.gbbd98

^ permalink raw reply related	[relevance 54%]

* [PATCH 1/4] send-email: actually add bcc headers
  @ 2010-03-07 21:33 55% ` Stephen Boyd
  0 siblings, 0 replies; 200+ results
From: Stephen Boyd @ 2010-03-07 21:33 UTC (permalink / raw)
  To: git; +Cc: Miklos Vajna, Steven Drake, Junio C Hamano

This bug looks ancient. In fact it doesn't look like --bcc ever worked
even when it was introduced in 5806324 (Add support for --bcc to
git-send-email., 2006-05-29).

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---
 git-send-email.perl   |    7 ++++++-
 t/t9001-send-email.sh |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index e05455f..3d9c832 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -856,11 +856,16 @@ sub send_message
 	if ($cc ne '') {
 		$ccline = "\nCc: $cc";
 	}
+	my $bcc = join(",\n\t", unique_email_list(@bcclist));
+	my $bccline = "";
+	if ($bcc ne '') {
+		$bccline = "\nBcc: $bcc";
+	}
 	my $sanitized_sender = sanitize_address($sender);
 	make_message_id() unless defined($message_id);
 
 	my $header = "From: $sanitized_sender
-To: $to${ccline}
+To: $to${ccline}${bccline}
 Subject: $subject
 Date: $date
 Message-Id: $message_id
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c09f375..db91721 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -149,6 +149,7 @@ Cc: cc@example.com,
 	A <author@example.com>,
 	One <one@example.com>,
 	two@example.com
+Bcc: bcc@example.com
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
 Message-Id: MESSAGE-ID-STRING
-- 
1.7.0.1.171.geb5ee

^ permalink raw reply related	[relevance 55%]

* [PATCH/RFC v4 3/7] gettext: Add a Gettext interface for Perl
  @ 2010-06-02  1:06 55% ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-06-02  1:06 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Jeff Epler,
	Ævar Arnfjörð Bjarmason

Make Git's gettext messages available to Perl programs through
Locale::Messages. Gracefully fall back to English on systems that
don't contain the module.

This contains some makefile hacks to pass localedir to
perl/Makefile. Which in turn passes it to perl.mak, which'll use it to
search/replace occurances of ++LOCALEDIR++ in .pm files.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile            |    6 +++-
 git-send-email.perl |    3 +-
 perl/Git/I18N.pm    |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++
 perl/Makefile       |    3 +-
 perl/Makefile.PL    |   14 +++++++++-
 5 files changed, 94 insertions(+), 5 deletions(-)
 create mode 100644 perl/Git/I18N.pm

diff --git a/Makefile b/Makefile
index dce2faa..3f0e305 100644
--- a/Makefile
+++ b/Makefile
@@ -1505,7 +1505,7 @@ ifndef NO_TCLTK
 	$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
 endif
 ifndef NO_PERL
-	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
+	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all
 endif
 ifndef NO_PYTHON
 	$(QUIET_SUBDIR0)git_remote_helpers $(QUIET_SUBDIR1) PYTHON_PATH='$(PYTHON_PATH_SQ)' prefix='$(prefix_SQ)' all
@@ -1884,7 +1884,9 @@ cscope:
 	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
 
 pot:
-	$(XGETTEXT) -k_ -o po/git.pot $(C_OBJ:o=c) $(SCRIPT_SH)
+	$(XGETTEXT) --keyword=_ --output=po/git.pot --language=C $(C_OBJ:o=c)
+	$(XGETTEXT) --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH)
+	$(XGETTEXT) --join-existing --output=po/git.pot --language=Perl $(SCRIPT_PERL)
 
 POFILES := $(wildcard po/*.po)
 MOFILES := $(patsubst po/%.po,share/locale/%/LC_MESSAGES/git.mo,$(POFILES))
diff --git a/git-send-email.perl b/git-send-email.perl
index 111c981..b9288af 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -26,6 +26,7 @@ use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
 use Error qw(:try);
 use Git;
+use Git::I18N;
 
 Getopt::Long::Configure qw/ pass_through /;
 
@@ -674,7 +675,7 @@ if (!defined $sender) {
 	$sender = $repoauthor || $repocommitter || '';
 	$sender = ask("Who should the emails appear to be from? [$sender] ",
 	              default => $sender);
-	print "Emails will be sent from: ", $sender, "\n";
+	printf gettext("Emails will be sent from: %s\n"), $sender;
 	$prompting++;
 }
 
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
new file mode 100644
index 0000000..e19d99b
--- /dev/null
+++ b/perl/Git/I18N.pm
@@ -0,0 +1,73 @@
+package Git::I18N;
+use strict;
+use warnings;
+use Exporter;
+use base 'Exporter';
+
+our $VERSION = '0.01';
+
+our @EXPORT = qw(gettext);
+our @EXPORT_OK = @EXPORT;
+
+sub __bootstrap_locale_messages {
+	our $TEXTDOMAIN = 'git';
+	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
+
+	require POSIX;
+	POSIX->import(qw(setlocale));
+	# Non-core prerequisite module
+	require Locale::Messages;
+	Locale::Messages->import(qw(:locale_h :libintl_h));
+
+	setlocale(LC_MESSAGES(), '');
+	setlocale(LC_CTYPE(), '');
+	textdomain($TEXTDOMAIN);
+	bindtextdomain($TEXTDOMAIN => $TEXTDOMAINDIR);
+
+	return;
+}
+
+BEGIN
+{
+	local ($@, $!);
+	eval { __bootstrap_locale_messages() };
+	if ($@) {
+		# Oh noes, no Locale::Messages here
+		*gettext = sub ($) { $_[0] };
+	}
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Git::I18N - Perl interface to Git's Gettext localizations
+
+=head1 SYNOPSIS
+
+	use Git::I18N;
+
+	print gettext("Welcome to Git!\n");
+
+	printf gettext("The following error occured: %s\n"), $error;
+
+=head1 DESCRIPTION
+
+Git's internal interface to Gettext via L<Locale::Messages>. If
+L<Locale::Messages> can't be loaded (it's not a core module) we
+provide stub passthrough fallbacks.
+
+=head1 FUNCTIONS
+
+=head2 gettext($)
+
+L<Locale::Messages>'s gettext function if all goes well, otherwise our
+passthrough fallback function.
+
+=head1 AUTHOR
+
+E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avarab@gmail.com>
+
+=cut
diff --git a/perl/Makefile b/perl/Makefile
index 4ab21d6..4e624ff 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -5,6 +5,7 @@ makfile:=perl.mak
 
 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
 prefix_SQ = $(subst ','\'',$(prefix))
+localedir_SQ = $(subst ','\'',$(localedir))
 
 ifndef V
 	QUIET = @
@@ -38,7 +39,7 @@ $(makfile): ../GIT-CFLAGS Makefile
 	echo '	echo $(instdir_SQ)' >> $@
 else
 $(makfile): Makefile.PL ../GIT-CFLAGS
-	$(PERL_PATH) $< PREFIX='$(prefix_SQ)'
+	$(PERL_PATH) $< PREFIX='$(prefix_SQ)' --localedir='$(localedir_SQ)'
 endif
 
 # this is just added comfort for calling make directly in perl dir
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index 0b9deca..456d45b 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -1,4 +1,12 @@
+use strict;
+use warnings;
 use ExtUtils::MakeMaker;
+use Getopt::Long;
+
+# Sanity: die at first unknown option
+Getopt::Long::Configure qw/ pass_through /;
+
+GetOptions("localedir=s" => \my $localedir);
 
 sub MY::postamble {
 	return <<'MAKE_FRAG';
@@ -16,7 +24,10 @@ endif
 MAKE_FRAG
 }
 
-my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');
+my %pm = (
+	'Git.pm' => '$(INST_LIBDIR)/Git.pm',
+	'Git/I18N.pm' => '$(INST_LIBDIR)/Git/I18N.pm',
+);
 
 # We come with our own bundled Error.pm. It's not in the set of default
 # Perl modules so install it if it's not available on the system yet.
@@ -33,6 +44,7 @@ WriteMakefile(
 	NAME            => 'Git',
 	VERSION_FROM    => 'Git.pm',
 	PM		=> \%pm,
+	PM_FILTER	=> qq[\$(PERL) -pe "s<\\Q++LOCALEDIR++\\E><$localedir>"],
 	MAKEFILE	=> 'perl.mak',
 	INSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'
 );
-- 
1.7.1.251.gec7f5.dirty

^ permalink raw reply related	[relevance 55%]

* [PATCH v5 2/2] send-email: expose header information to git-send-email's sendemail-validate hook
  @ 2023-01-10 21:16 55% ` Strawbridge, Michael
  0 siblings, 0 replies; 200+ results
From: Strawbridge, Michael @ 2023-01-10 21:16 UTC (permalink / raw)
  To: git@vger.kernel.org; +Cc: Strawbridge, Michael, Tuikov, Luben, Junio C Hamano

To allow further flexibility in the git hook, the SMTP header
information of the email that git-send-email intends to send, is now
passed as a 2nd argument to the sendemail-validate hook.

As an example, this can be useful for acting upon keywords in the
subject or specific email addresses.

Cc: Luben Tuikov <luben.tuikov@amd.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Strawbridge <michael.strawbridge@amd.com>
---
 Documentation/githooks.txt | 17 +++++++++++++----
 git-send-email.perl        | 31 +++++++++++++++++++++----------
 t/t9001-send-email.sh      | 29 +++++++++++++++++++++++++++--
 3 files changed, 61 insertions(+), 16 deletions(-)

diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index a16e62bc8c..2b5c6640cc 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -583,10 +583,19 @@ processed by rebase.
 sendemail-validate
 ~~~~~~~~~~~~~~~~~~
 
-This hook is invoked by linkgit:git-send-email[1].  It takes a single parameter,
-the name of the file that holds the e-mail to be sent.  Exiting with a
-non-zero status causes `git send-email` to abort before sending any
-e-mails.
+This hook is invoked by linkgit:git-send-email[1].
+
+It takes these command line arguments:
+1. the name of the file that holds the e-mail to be sent.
+2. the name of the file that holds the SMTP headers to be used.
+
+The hook doesn't need to support multiple header names (for example only Cc
+is passed). However, it does need to understand that lines beginning with
+whitespace belong to the previous header.  The header information follows
+the same format as the confirmation given at the end of send-email.
+
+Exiting with a non-zero status causes `git send-email` to abort
+before sending any e-mails.
 
 fsmonitor-watchman
 ~~~~~~~~~~~~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 810dd1f1ce..b2adca515e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -787,14 +787,6 @@ sub is_format_patch_arg {
 
 @files = handle_backup_files(@files);
 
-if ($validate) {
-	foreach my $f (@files) {
-		unless (-p $f) {
-			validate_patch($f, $target_xfer_encoding);
-		}
-	}
-}
-
 if (@files) {
 	unless ($quiet) {
 		print $_,"\n" for (@files);
@@ -1738,6 +1730,16 @@ sub send_message {
 	return 1;
 }
 
+if ($validate) {
+	foreach my $f (@files) {
+		unless (-p $f) {
+		        pre_process_file($f, 1);
+
+			validate_patch($f, $target_xfer_encoding);
+		}
+	}
+}
+
 $in_reply_to = $initial_in_reply_to;
 $references = $initial_in_reply_to || '';
 $message_num = 0;
@@ -2101,11 +2103,20 @@ sub validate_patch {
 			chdir($repo->wc_path() or $repo->repo_path())
 				or die("chdir: $!");
 			local $ENV{"GIT_DIR"} = $repo->repo_path();
+
+			my ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header) = gen_header();
+
+			require File::Temp;
+			my ($header_filehandle, $header_filename) = File::Temp::tempfile(
+                            ".gitsendemail.header.XXXXXX", DIR => $repo->repo_path());
+			print $header_filehandle $header;
+
 			my @cmd = ("git", "hook", "run", "--ignore-missing",
 				    $hook_name, "--");
-			my @cmd_msg = (@cmd, "<patch>");
-			my @cmd_run = (@cmd, $target);
+			my @cmd_msg = (@cmd, "<patch>", "<header>");
+			my @cmd_run = (@cmd, $target, $header_filename);
 			$hook_error = system_or_msg(\@cmd_run, undef, "@cmd_msg");
+			unlink($header_filehandle);
 			chdir($cwd_save) or die("chdir: $!");
 		}
 		if ($hook_error) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1130ef21b3..f02b1eba16 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -540,7 +540,7 @@ test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
 	test_path_is_file my-hooks.ran &&
 	cat >expect <<-EOF &&
 	fatal: longline.patch: rejected by sendemail-validate hook
-	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
 	warning: no patches were sent
 	EOF
 	test_cmp expect actual
@@ -559,7 +559,32 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
 	test_path_is_file my-hooks.ran &&
 	cat >expect <<-EOF &&
 	fatal: longline.patch: rejected by sendemail-validate hook
-	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
+	warning: no patches were sent
+	EOF
+	test_cmp expect actual
+'
+
+test_expect_success $PREREQ "--validate hook supports header argument" '
+	test_when_finished "rm my-hooks.ran" &&
+	write_script my-hooks/sendemail-validate <<-\EOF &&
+	filesize=$(stat -c%s "$2")
+	if [ "$filesize" != "0" ]; then
+	>my-hooks.ran
+	fi
+	exit 1
+	EOF
+	test_config core.hooksPath "my-hooks" &&
+	test_must_fail git send-email \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		--validate \
+		longline.patch 2>actual &&
+	test_path_is_file my-hooks.ran &&
+	cat >expect <<-EOF &&
+	fatal: longline.patch: rejected by sendemail-validate hook
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
 	warning: no patches were sent
 	EOF
 	test_cmp expect actual
-- 
2.34.1

^ permalink raw reply related	[relevance 55%]

* [PATCH v5 2/2] send-email: expose header information to git-send-email's sendemail-validate hook
  @ 2023-01-17  1:37 55% ` Strawbridge, Michael
  0 siblings, 0 replies; 200+ results
From: Strawbridge, Michael @ 2023-01-17  1:37 UTC (permalink / raw)
  To: git@vger.kernel.org; +Cc: Strawbridge, Michael, Tuikov, Luben, Junio C Hamano

To allow further flexibility in the git hook, the SMTP header
information of the email that git-send-email intends to send, is now
passed as a 2nd argument to the sendemail-validate hook.

As an example, this can be useful for acting upon keywords in the
subject or specific email addresses.

Cc: Luben Tuikov <luben.tuikov@amd.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Strawbridge <michael.strawbridge@amd.com>
---
 Documentation/githooks.txt | 17 +++++++++++++----
 git-send-email.perl        | 31 +++++++++++++++++++++----------
 t/t9001-send-email.sh      | 29 +++++++++++++++++++++++++++--
 3 files changed, 61 insertions(+), 16 deletions(-)

diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index a16e62bc8c..2b5c6640cc 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -583,10 +583,19 @@ processed by rebase.
 sendemail-validate
 ~~~~~~~~~~~~~~~~~~
 
-This hook is invoked by linkgit:git-send-email[1].  It takes a single parameter,
-the name of the file that holds the e-mail to be sent.  Exiting with a
-non-zero status causes `git send-email` to abort before sending any
-e-mails.
+This hook is invoked by linkgit:git-send-email[1].
+
+It takes these command line arguments:
+1. the name of the file that holds the e-mail to be sent.
+2. the name of the file that holds the SMTP headers to be used.
+
+The hook doesn't need to support multiple header names (for example only Cc
+is passed). However, it does need to understand that lines beginning with
+whitespace belong to the previous header.  The header information follows
+the same format as the confirmation given at the end of send-email.
+
+Exiting with a non-zero status causes `git send-email` to abort
+before sending any e-mails.
 
 fsmonitor-watchman
 ~~~~~~~~~~~~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 810dd1f1ce..b2adca515e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -787,14 +787,6 @@ sub is_format_patch_arg {
 
 @files = handle_backup_files(@files);
 
-if ($validate) {
-	foreach my $f (@files) {
-		unless (-p $f) {
-			validate_patch($f, $target_xfer_encoding);
-		}
-	}
-}
-
 if (@files) {
 	unless ($quiet) {
 		print $_,"\n" for (@files);
@@ -1738,6 +1730,16 @@ sub send_message {
 	return 1;
 }
 
+if ($validate) {
+	foreach my $f (@files) {
+		unless (-p $f) {
+		        pre_process_file($f, 1);
+
+			validate_patch($f, $target_xfer_encoding);
+		}
+	}
+}
+
 $in_reply_to = $initial_in_reply_to;
 $references = $initial_in_reply_to || '';
 $message_num = 0;
@@ -2101,11 +2103,20 @@ sub validate_patch {
 			chdir($repo->wc_path() or $repo->repo_path())
 				or die("chdir: $!");
 			local $ENV{"GIT_DIR"} = $repo->repo_path();
+
+			my ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header) = gen_header();
+
+			require File::Temp;
+			my ($header_filehandle, $header_filename) = File::Temp::tempfile(
+                            ".gitsendemail.header.XXXXXX", DIR => $repo->repo_path());
+			print $header_filehandle $header;
+
 			my @cmd = ("git", "hook", "run", "--ignore-missing",
 				    $hook_name, "--");
-			my @cmd_msg = (@cmd, "<patch>");
-			my @cmd_run = (@cmd, $target);
+			my @cmd_msg = (@cmd, "<patch>", "<header>");
+			my @cmd_run = (@cmd, $target, $header_filename);
 			$hook_error = system_or_msg(\@cmd_run, undef, "@cmd_msg");
+			unlink($header_filehandle);
 			chdir($cwd_save) or die("chdir: $!");
 		}
 		if ($hook_error) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1130ef21b3..f02b1eba16 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -540,7 +540,7 @@ test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
 	test_path_is_file my-hooks.ran &&
 	cat >expect <<-EOF &&
 	fatal: longline.patch: rejected by sendemail-validate hook
-	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
 	warning: no patches were sent
 	EOF
 	test_cmp expect actual
@@ -559,7 +559,32 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
 	test_path_is_file my-hooks.ran &&
 	cat >expect <<-EOF &&
 	fatal: longline.patch: rejected by sendemail-validate hook
-	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
+	warning: no patches were sent
+	EOF
+	test_cmp expect actual
+'
+
+test_expect_success $PREREQ "--validate hook supports header argument" '
+	test_when_finished "rm my-hooks.ran" &&
+	write_script my-hooks/sendemail-validate <<-\EOF &&
+	filesize=$(stat -c%s "$2")
+	if [ "$filesize" != "0" ]; then
+	>my-hooks.ran
+	fi
+	exit 1
+	EOF
+	test_config core.hooksPath "my-hooks" &&
+	test_must_fail git send-email \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		--validate \
+		longline.patch 2>actual &&
+	test_path_is_file my-hooks.ran &&
+	cat >expect <<-EOF &&
+	fatal: longline.patch: rejected by sendemail-validate hook
+	fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
 	warning: no patches were sent
 	EOF
 	test_cmp expect actual
-- 
2.34.1

^ permalink raw reply related	[relevance 55%]

* [PATCH] send-email: add --confirm option
@ 2009-03-01  8:23 55% Jay Soffian
  0 siblings, 0 replies; 200+ results
From: Jay Soffian @ 2009-03-01  8:23 UTC (permalink / raw)
  To: git; +Cc: Jay Soffian, Nanako Shiraishi, Junio C Hamano, Paul Gortmaker

send-email violates the principle of least surprise by automatically
cc'ing additional recipients without confirming this with the user.

This patch teaches send-email a --confirm option. It takes the
following values:

 --confirm=always   always confirm before sending
 --confirm=never    never confirm before sending
 --confirm=cc       confirm before sending when send-email has
                    automatically added addresses from the patch to
                    the Cc list
 --confirm=compose  confirm before sending the first message when
                    using --compose. (Needed to maintain backwards
                    compatibility with existing behavior.)
 --confirm=auto     'cc' + 'compose'

The option defaults to 'compose' if any suppress Cc related options have
been used, otherwise it defaults to 'auto'.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---
Junio,

I based this on top of js/send-email.

j.

 Documentation/git-send-email.txt |   16 ++++++++
 git-send-email.perl              |   68 +++++++++++++++++++++++------------
 t/t9001-send-email.sh            |   72 +++++++++++++++++++++++++++++--------
 3 files changed, 117 insertions(+), 39 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 164d149..bcf7ff1 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -199,6 +199,22 @@ specified, as well as 'body' if --no-signed-off-cc is specified.
 Administering
 ~~~~~~~~~~~~~
 
+--confirm::
+	Confirm just before sending:
++
+--
+- 'always' will always confirm before sending
+- 'never' will never confirm before sending
+- 'cc' will confirm before sending when send-email has automatically
+  added addresses from the patch to the Cc list
+- 'compose' will confirm before sending the first message when using --compose.
+- 'auto' is equivalent to 'cc' + 'compose'
+--
++
+Default is the value of 'sendemail.confirm' configuration value; if that
+is unspecified, default to 'auto' unless any of the suppress options
+have been specified, in which case default to 'compose'.
+
 --dry-run::
 	Do everything except actually send the emails.
 
diff --git a/git-send-email.perl b/git-send-email.perl
index adf7ecb..a777e3f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -75,6 +75,8 @@ git send-email [options] <file | directory | rev-list options >
     --[no-]thread                  * Use In-Reply-To: field. Default on.
 
   Administering:
+    --confirm               <str>  * Confirm recipients before sending;
+                                     auto, cc, compose, always, or never.
     --quiet                        * Output one line of info per email.
     --dry-run                      * Don't actually send the emails.
     --[no-]validate                * Perform patch sanity checks. Default on.
@@ -181,7 +183,7 @@ sub do_edit {
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
-my ($validate);
+my ($validate, $confirm);
 my (@suppress_cc);
 
 my %config_bool_settings = (
@@ -207,6 +209,7 @@ my %config_settings = (
     "suppresscc" => \@suppress_cc,
     "envelopesender" => \$envelope_sender,
     "multiedit" => \$multiedit,
+    "confirm"   => \$confirm,
 );
 
 # Handle Uncouth Termination
@@ -258,6 +261,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "suppress-from!" => \$suppress_from,
 		    "suppress-cc=s" => \@suppress_cc,
 		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
+		    "confirm=s" => \$confirm,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
@@ -346,6 +350,11 @@ if ($suppress_cc{'body'}) {
 	delete $suppress_cc{'body'};
 }
 
+# Set confirm
+if (!defined $confirm) {
+	$confirm = scalar %suppress_cc ? 'compose' : 'auto';
+};
+
 # Debugging, print out the suppressions.
 if (0) {
 	print "suppressions:\n";
@@ -663,25 +672,13 @@ if (!defined $smtp_server) {
 	$smtp_server ||= 'localhost'; # could be 127.0.0.1, too... *shrug*
 }
 
-if ($compose) {
-	while (1) {
-		$_ = $term->readline("Send this email? (y|n) ");
-		last if defined $_;
-		print "\n";
-	}
-
-	if (uc substr($_,0,1) ne 'Y') {
-		cleanup_compose_files();
-		exit(0);
-	}
-
-	if ($compose > 0) {
-		@files = ($compose_filename . ".final", @files);
-	}
+if ($compose && $compose > 0) {
+	@files = ($compose_filename . ".final", @files);
 }
 
 # Variables we set as part of the loop over files
-our ($message_id, %mail, $subject, $reply_to, $references, $message);
+our ($message_id, %mail, $subject, $reply_to, $references, $message,
+	$needs_confirm, $message_num);
 
 sub extract_valid_address {
 	my $address = shift;
@@ -837,6 +834,25 @@ X-Mailer: git-send-email $gitversion
 	unshift (@sendmail_parameters,
 			'-f', $raw_from) if(defined $envelope_sender);
 
+	if ($needs_confirm && !$dry_run) {
+		print "\n$header\n";
+		while (1) {
+			chomp ($_ = $term->readline(
+				"Send this email? ([y]es|[n]o|[q]uit|[a]ll): "
+			));
+			last if /^(?:yes|y|no|n|quit|q|all|a)/i;
+			print "\n";
+		}
+		if (/^n/i) {
+			return;
+		} elsif (/^q/i) {
+			cleanup_compose_files();
+			exit(0);
+		} elsif (/^a/i) {
+			$confirm = 'never';
+		}
+	}
+
 	if ($dry_run) {
 		# We don't want to send the email.
 	} elsif ($smtp_server =~ m#^/#) {
@@ -935,6 +951,7 @@ X-Mailer: git-send-email $gitversion
 $reply_to = $initial_reply_to;
 $references = $initial_reply_to || '';
 $subject = $initial_subject;
+$message_num = 0;
 
 foreach my $t (@files) {
 	open(F,"<",$t) or die "can't open file $t";
@@ -943,11 +960,12 @@ foreach my $t (@files) {
 	my $author_encoding;
 	my $has_content_type;
 	my $body_encoding;
-	@cc = @initial_cc;
+	@cc = ();
 	@xh = ();
 	my $input_format = undef;
 	my @header = ();
 	$message = "";
+	$message_num++;
 	# First unfold multiline header fields
 	while(<F>) {
 		last if /^\s*$/;
@@ -1080,6 +1098,13 @@ foreach my $t (@files) {
 		}
 	}
 
+	$needs_confirm = (
+		$confirm eq "always" or
+		($confirm =~ /^(?:auto|cc)$/ && @cc) or
+		($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));
+
+	@cc = (@initial_cc, @cc);
+
 	send_message();
 
 	# set up for the next message
@@ -1094,13 +1119,10 @@ foreach my $t (@files) {
 	$message_id = undef;
 }
 
-if ($compose) {
-	cleanup_compose_files();
-}
+cleanup_compose_files();
 
 sub cleanup_compose_files() {
-	unlink($compose_filename, $compose_filename . ".final");
-
+	unlink($compose_filename, $compose_filename . ".final") if $compose;
 }
 
 $smtp->quit if $smtp;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 4df4f96..2f4a654 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -31,6 +31,11 @@ clean_fake_sendmail() {
 	rm -f commandline* msgtxt*
 }
 
+# Prevent any tests from hanging
+test_expect_success 'Set sendemail.confirm=never' '
+	git config sendemail.confirm never
+'
+
 test_expect_success 'Extract patches' '
     patches=`git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1`
 '
@@ -175,15 +180,13 @@ test_set_editor "$(pwd)/fake-editor"
 
 test_expect_success '--compose works' '
 	clean_fake_sendmail &&
-	echo y | \
-		GIT_SEND_EMAIL_NOTTY=1 \
-		git send-email \
-		--compose --subject foo \
-		--from="Example <nobody@example.com>" \
-		--to=nobody@example.com \
-		--smtp-server="$(pwd)/fake.sendmail" \
-		$patches \
-		2>errors
+	git send-email \
+	--compose --subject foo \
+	--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' '
@@ -375,15 +378,56 @@ test_expect_success '--suppress-cc=cc' '
 	test_suppression cc
 '
 
+test_confirm () {
+	echo y | \
+		GIT_SEND_EMAIL_NOTTY=1 \
+		git send-email \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		$@ \
+		$patches | grep "Send this email"
+}
+
+test_expect_success '--confirm=always' '
+	test_confirm --confirm=always --suppress-cc=all
+'
+
+test_expect_success '--confirm=auto' '
+	test_confirm --confirm=auto
+'
+
+test_expect_success '--confirm=cc' '
+	test_confirm --confirm=cc
+'
+
+test_expect_success '--confirm=compose' '
+	test_confirm --confirm=compose --compose
+'
+
+test_expect_success 'confirm by default (due to cc)' '
+	CONFIRM=$(git config --get sendemail.confirm) &&
+	git config --unset sendemail.confirm &&
+	test_confirm &&
+	git config sendemail.confirm $CONFIRM
+'
+
+test_expect_success 'confirm by default (due to --compose)' '
+	CONFIRM=$(git config --get sendemail.confirm) &&
+	git config --unset sendemail.confirm &&
+	test_confirm --suppress-cc=all --compose
+	ret="$?"
+	git config sendemail.confirm ${CONFIRM:-never}
+	test $ret = "0"
+'
+
 test_expect_success '--compose adds MIME for utf8 body' '
 	clean_fake_sendmail &&
 	(echo "#!$SHELL_PATH" &&
 	 echo "echo utf8 body: àéìöú >>\"\$1\""
 	) >fake-editor-utf8 &&
 	chmod +x fake-editor-utf8 &&
-	echo y | \
 	  GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
-	  GIT_SEND_EMAIL_NOTTY=1 \
 	  git send-email \
 	  --compose --subject foo \
 	  --from="Example <nobody@example.com>" \
@@ -405,9 +449,7 @@ test_expect_success '--compose respects user mime type' '
 	 echo " echo utf8 body: àéìöú) >\"\$1\""
 	) >fake-editor-utf8-mime &&
 	chmod +x fake-editor-utf8-mime &&
-	echo y | \
 	  GIT_EDITOR="\"$(pwd)/fake-editor-utf8-mime\"" \
-	  GIT_SEND_EMAIL_NOTTY=1 \
 	  git send-email \
 	  --compose --subject foo \
 	  --from="Example <nobody@example.com>" \
@@ -421,9 +463,7 @@ test_expect_success '--compose respects user mime type' '
 
 test_expect_success '--compose adds MIME for utf8 subject' '
 	clean_fake_sendmail &&
-	echo y | \
 	  GIT_EDITOR="\"$(pwd)/fake-editor\"" \
-	  GIT_SEND_EMAIL_NOTTY=1 \
 	  git send-email \
 	  --compose --subject utf8-sübjëct \
 	  --from="Example <nobody@example.com>" \
@@ -445,7 +485,7 @@ test_expect_success 'detects ambiguous reference/file conflict' '
 test_expect_success 'feed two files' '
 	rm -fr outdir &&
 	git format-patch -2 -o outdir &&
-	GIT_SEND_EMAIL_NOTTY=1 git send-email \
+	git send-email \
 	--dry-run \
 	--from="Example <nobody@example.com>" \
 	--to=nobody@example.com \
-- 
1.6.2.rc1.309.g5f417

^ permalink raw reply related	[relevance 55%]

* [PATCH/RFC v3 3/7] gettext: Add a Gettext interface for Perl
    2010-05-30 20:54 56% ` [PATCH/RFC v2 5/6] gettext: Add a Gettext interface for Perl Ævar Arnfjörð Bjarmason
@ 2010-06-01 23:39 55% ` Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-06-01 23:39 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Jeff Epler,
	Ævar Arnfjörð Bjarmason

Make Git's gettext messages available to Perl programs through
Locale::Messages. Gracefully fall back to English on systems that
don't contain the module.

This contains some makefile hacks to pass localedir to
perl/Makefile. Which in turn passes it to perl.mak, which'll use it to
search/replace occurances of ++LOCALEDIR++ in .pm files.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile            |    6 +++-
 git-send-email.perl |    3 +-
 perl/Git/I18N.pm    |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++
 perl/Makefile       |    3 +-
 perl/Makefile.PL    |   14 +++++++++-
 5 files changed, 94 insertions(+), 5 deletions(-)
 create mode 100644 perl/Git/I18N.pm

diff --git a/Makefile b/Makefile
index dce2faa..3f0e305 100644
--- a/Makefile
+++ b/Makefile
@@ -1505,7 +1505,7 @@ ifndef NO_TCLTK
 	$(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
 endif
 ifndef NO_PERL
-	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
+	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all
 endif
 ifndef NO_PYTHON
 	$(QUIET_SUBDIR0)git_remote_helpers $(QUIET_SUBDIR1) PYTHON_PATH='$(PYTHON_PATH_SQ)' prefix='$(prefix_SQ)' all
@@ -1884,7 +1884,9 @@ cscope:
 	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
 
 pot:
-	$(XGETTEXT) -k_ -o po/git.pot $(C_OBJ:o=c) $(SCRIPT_SH)
+	$(XGETTEXT) --keyword=_ --output=po/git.pot --language=C $(C_OBJ:o=c)
+	$(XGETTEXT) --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH)
+	$(XGETTEXT) --join-existing --output=po/git.pot --language=Perl $(SCRIPT_PERL)
 
 POFILES := $(wildcard po/*.po)
 MOFILES := $(patsubst po/%.po,share/locale/%/LC_MESSAGES/git.mo,$(POFILES))
diff --git a/git-send-email.perl b/git-send-email.perl
index 111c981..b9288af 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -26,6 +26,7 @@ use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
 use Error qw(:try);
 use Git;
+use Git::I18N;
 
 Getopt::Long::Configure qw/ pass_through /;
 
@@ -674,7 +675,7 @@ if (!defined $sender) {
 	$sender = $repoauthor || $repocommitter || '';
 	$sender = ask("Who should the emails appear to be from? [$sender] ",
 	              default => $sender);
-	print "Emails will be sent from: ", $sender, "\n";
+	printf gettext("Emails will be sent from: %s\n"), $sender;
 	$prompting++;
 }
 
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
new file mode 100644
index 0000000..568fd3d
--- /dev/null
+++ b/perl/Git/I18N.pm
@@ -0,0 +1,73 @@
+package Git::I18N;
+use strict;
+use warnings;
+use Exporter;
+use base 'Exporter';
+
+our $VERSION = '0.01';
+
+our @EXPORT = qw(gettext);
+our @EXPORT_OK = @EXPORT;
+
+sub __bootstrap_locale_messages {
+	our $TEXTDOMAIN = 'git';
+	our $TEXTDOMAINDIR = '++LOCALEDIR++';
+
+	require POSIX;
+	POSIX->import(qw(setlocale));
+	# Non-core prerequisite module
+	require Locale::Messages;
+	Locale::Messages->import(qw(:locale_h :libintl_h));
+
+	setlocale(LC_MESSAGES(), '');
+	setlocale(LC_CTYPE(), '');
+	textdomain($TEXTDOMAIN);
+	bindtextdomain($TEXTDOMAIN => $TEXTDOMAINDIR);
+
+	return;
+}
+
+BEGIN
+{
+	local ($@, $!);
+	eval { __bootstrap_locale_messages() };
+	if ($@) {
+		# Oh noes, no Locale::Messages here
+		*gettext = sub ($) { $_[0] };
+	}
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Git::I18N - Perl interface to Git's Gettext localizations
+
+=head1 SYNOPSIS
+
+	use Git::I18N;
+
+	print gettext("Welcome to Git!\n");
+
+	printf gettext("The following error occured: %s\n"), $error;
+
+=head1 DESCRIPTION
+
+Git's internal interface to Gettext via L<Locale::Messages>. If
+L<Locale::Messages> can't be loaded (it's not a core module) we
+provide stub passthrough fallbacks.
+
+=head1 FUNCTIONS
+
+=head2 gettext($)
+
+L<Locale::Messages>'s gettext function if all goes well, otherwise our
+passthrough fallback function.
+
+=head1 AUTHOR
+
+E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avarab@gmail.com>
+
+=cut
diff --git a/perl/Makefile b/perl/Makefile
index 4ab21d6..4e624ff 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -5,6 +5,7 @@ makfile:=perl.mak
 
 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
 prefix_SQ = $(subst ','\'',$(prefix))
+localedir_SQ = $(subst ','\'',$(localedir))
 
 ifndef V
 	QUIET = @
@@ -38,7 +39,7 @@ $(makfile): ../GIT-CFLAGS Makefile
 	echo '	echo $(instdir_SQ)' >> $@
 else
 $(makfile): Makefile.PL ../GIT-CFLAGS
-	$(PERL_PATH) $< PREFIX='$(prefix_SQ)'
+	$(PERL_PATH) $< PREFIX='$(prefix_SQ)' --localedir='$(localedir_SQ)'
 endif
 
 # this is just added comfort for calling make directly in perl dir
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index 0b9deca..456d45b 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -1,4 +1,12 @@
+use strict;
+use warnings;
 use ExtUtils::MakeMaker;
+use Getopt::Long;
+
+# Sanity: die at first unknown option
+Getopt::Long::Configure qw/ pass_through /;
+
+GetOptions("localedir=s" => \my $localedir);
 
 sub MY::postamble {
 	return <<'MAKE_FRAG';
@@ -16,7 +24,10 @@ endif
 MAKE_FRAG
 }
 
-my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');
+my %pm = (
+	'Git.pm' => '$(INST_LIBDIR)/Git.pm',
+	'Git/I18N.pm' => '$(INST_LIBDIR)/Git/I18N.pm',
+);
 
 # We come with our own bundled Error.pm. It's not in the set of default
 # Perl modules so install it if it's not available on the system yet.
@@ -33,6 +44,7 @@ WriteMakefile(
 	NAME            => 'Git',
 	VERSION_FROM    => 'Git.pm',
 	PM		=> \%pm,
+	PM_FILTER	=> qq[\$(PERL) -pe "s<\\Q++LOCALEDIR++\\E><$localedir>"],
 	MAKEFILE	=> 'perl.mak',
 	INSTALLSITEMAN3DIR => '$(SITEPREFIX)/share/man/man3'
 );
-- 
1.7.1.248.gb7713.dirty

^ permalink raw reply related	[relevance 55%]

* [PATCH v3] git-send-email: honor $PATH for sendmail binary
  @ 2017-11-28  0:49 55% ` Florian Klink
  0 siblings, 0 replies; 200+ results
From: Florian Klink @ 2017-11-28  0:49 UTC (permalink / raw)
  To: git; +Cc: flokli, sandals, gitster

This extends git-send-email to also consider sendmail binaries in $PATH
after checking the (fixed) list of /usr/sbin and /usr/lib, and before
falling back to localhost.

Signed-off-by: Florian Klink <flokli@flokli.de>
---
 Documentation/git-send-email.txt | 6 +++---
 git-send-email.perl              | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index bac9014ac..44db25567 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -203,9 +203,9 @@ a password is obtained using 'git-credential'.
 	specify a full pathname of a sendmail-like program instead;
 	the program must support the `-i` option.  Default value can
 	be specified by the `sendemail.smtpServer` configuration
-	option; the built-in default is `/usr/sbin/sendmail` or
-	`/usr/lib/sendmail` if such program is available, or
-	`localhost` otherwise.
+	option; the built-in default is to search for `sendmail` in
+	`/usr/sbin`, `/usr/lib/sendmail` and $PATH if such program is
+	available, falling back to `localhost` otherwise.
 
 --smtp-server-port=<port>::
 	Specifies a port different from the default port (SMTP
diff --git a/git-send-email.perl b/git-send-email.perl
index 2208dcc21..edcc6d346 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -885,7 +885,9 @@ if (defined $initial_reply_to) {
 }
 
 if (!defined $smtp_server) {
-	foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
+	my @sendmail_paths = qw( /usr/sbin/sendmail /usr/lib/sendmail );
+	push @sendmail_paths, map {"$_/sendmail"} split /:/, $ENV{PATH};
+	foreach (@sendmail_paths) {
 		if (-x $_) {
 			$smtp_server = $_;
 			last;
-- 
2.15.0


^ permalink raw reply related	[relevance 55%]

* Re* [PATCH] send-email: improve SSL certificate verification
  @ 2013-07-18 16:53 55%                   ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2013-07-18 16:53 UTC (permalink / raw)
  To: Torsten Bögershausen, Ramkumar Ramachandra
  Cc: brian m. carlson, Git List

Torsten Bögershausen <tboegi@web.de> writes:

> I wasn't sure where to apply the patch, so I manually copy/paste it
> on top of pu:
> commit 6b1ca0f4d443ee8716857b871b0513ae85c9f112
> Merge: bce90ab f351fcf
>
> Thanks, t9001 passes on Mac OS X 10.6.
> To be sure I didn't messed it up, please see the diff below.
> When it shows up on pu, I can re-test of course.

As the history of rr/send-email-ssl-verify needs rewriting to squash
this change in, here is a single patch with which I would propose to
replace all the commits accumulated on that branch.

Ramkumar, as you will still be the primary author of the resulting
commit, I tentatively added a line for your sign-off even though you
haven't signed off _this_ version yet, so that I would not forget.
If this version looks good, please tell us you would.

Torsten, I have Tested-by with your name, again so that I would not
forget, but obviously this one hasn't been tested by you yet.  If
this tests OK, please tell us so.

Thanks.

-- >8 --
From: Ramkumar Ramachandra <artagnon@gmail.com>
Subject: send-email: be explicit with SSL certificate verification

When initiating an SSL connection without explicitly specifying the
SSL certificate verification mode, Net::SMTP::SSL defaults to no
verification, but recent versions of the module gives a warning
against this use of the default.

Enable certificate verification by default, using /etc/ssl/certs as
the default path for certificates of certificate authorities.  This
path can be overriden by the --smtp-ssl-cert-path command line
option and the sendemail.smtpSSLCertPath configuration variable.

Passing an empty string as the path for CA certificates path disables
the SSL certificate verification explicitly, which does not trigger
the warning from recent versions of Net::SMTP::SSL.

(PROVISO) Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Helped-by: Brian M. Carlson <sandals@crustytoothpaste.net>
(PROVISO) Tested-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/config.txt         |  4 ++++
 Documentation/git-send-email.txt |  6 ++++++
 git-send-email.perl              | 41 +++++++++++++++++++++++++++++++++++++---
 3 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 6e53fc5..4de154c 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2022,6 +2022,10 @@ sendemail.smtpencryption::
 sendemail.smtpssl::
 	Deprecated alias for 'sendemail.smtpencryption = ssl'.
 
+sendemail.smtpsslcertpath::
+	Path to ca-certificates (either a directory or a single file).
+	Set it to an empty string to disable certificate verification.
+
 sendemail.<identity>.*::
 	Identity-specific versions of the 'sendemail.*' parameters
 	found below, taking precedence over those when the this
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 40a9a9a..f0e57a5 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -198,6 +198,12 @@ must be used for each option.
 --smtp-ssl::
 	Legacy alias for '--smtp-encryption ssl'.
 
+--smtp-ssl-cert-path::
+	Path to ca-certificates (either a directory or a single file).
+	Set it to an empty string to disable certificate verification.
+	Defaults to the value set to the 'sendemail.smtpsslcertpath'
+	configuration variable, if set, or `/etc/ssl/certs` otherwise.
+
 --smtp-user=<user>::
 	Username for SMTP-AUTH. Default is the value of 'sendemail.smtpuser';
 	if a username is not specified (with '--smtp-user' or 'sendemail.smtpuser'),
diff --git a/git-send-email.perl b/git-send-email.perl
index bd13cc8..60eaed3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -69,6 +69,9 @@ sub usage {
     --smtp-pass             <str>  * Password for SMTP-AUTH; not necessary.
     --smtp-encryption       <str>  * tls or ssl; anything else disables.
     --smtp-ssl                     * Deprecated. Use '--smtp-encryption ssl'.
+    --smtp-ssl-cert-path    <str>  * Path to ca-certificates (either directory or file).
+                                     Pass an empty string to disable certificate
+                                     verification.
     --smtp-domain           <str>  * The domain name sent to HELO/EHLO handshake
     --smtp-debug            <0|1>  * Disable, enable Net::SMTP debug.
 
@@ -194,7 +197,7 @@ sub do_edit {
 my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);
 my ($to_cmd, $cc_cmd);
 my ($smtp_server, $smtp_server_port, @smtp_server_options);
-my ($smtp_authuser, $smtp_encryption);
+my ($smtp_authuser, $smtp_encryption, $smtp_ssl_cert_path);
 my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
 my ($validate, $confirm);
 my (@suppress_cc);
@@ -222,6 +225,7 @@ sub do_edit {
     "smtpserveroption" => \@smtp_server_options,
     "smtpuser" => \$smtp_authuser,
     "smtppass" => \$smtp_authpass,
+    "smtpsslcertpath" => \$smtp_ssl_cert_path,
     "smtpdomain" => \$smtp_domain,
     "to" => \@initial_to,
     "tocmd" => \$to_cmd,
@@ -302,6 +306,7 @@ sub signal_handler {
 		    "smtp-pass:s" => \$smtp_authpass,
 		    "smtp-ssl" => sub { $smtp_encryption = 'ssl' },
 		    "smtp-encryption=s" => \$smtp_encryption,
+		    "smtp-ssl-cert-path" => \$smtp_ssl_cert_path,
 		    "smtp-debug:i" => \$debug_net_smtp,
 		    "smtp-domain:s" => \$smtp_domain,
 		    "identity=s" => \$identity,
@@ -1089,6 +1094,34 @@ sub smtp_auth_maybe {
 	return $auth;
 }
 
+sub ssl_verify_params {
+	eval {
+		require IO::Socket::SSL;
+		IO::Socket::SSL->import(qw/SSL_VERIFY_PEER SSL_VERIFY_NONE/);
+	};
+	if ($@) {
+		print STDERR "Not using SSL_VERIFY_PEER due to out-of-date IO::Socket::SSL.\n";
+		return;
+	}
+
+	if (!defined $smtp_ssl_cert_path) {
+		$smtp_ssl_cert_path = "/etc/ssl/certs";
+	}
+
+	if ($smtp_ssl_cert_path eq "") {
+		return (SSL_verify_mode => SSL_VERIFY_NONE());
+	} elsif (-d $smtp_ssl_cert_path) {
+		return (SSL_verify_mode => SSL_VERIFY_PEER(),
+			SSL_ca_path => $smtp_ssl_cert_path);
+	} elsif (-f $smtp_ssl_cert_path) {
+		return (SSL_verify_mode => SSL_VERIFY_PEER(),
+			SSL_ca_file => $smtp_ssl_cert_path);
+	} else {
+		print STDERR "Not using SSL_VERIFY_PEER because the CA path does not exist.\n";
+		return (SSL_verify_mode => SSL_VERIFY_NONE());
+	}
+}
+
 # Returns 1 if the message was sent, and 0 otherwise.
 # In actuality, the whole program dies when there
 # is an error sending a message.
@@ -1194,7 +1227,8 @@ sub send_message {
 			$smtp_domain ||= maildomain();
 			$smtp ||= Net::SMTP::SSL->new($smtp_server,
 						      Hello => $smtp_domain,
-						      Port => $smtp_server_port);
+						      Port => $smtp_server_port,
+						      ssl_verify_params());
 		}
 		else {
 			require Net::SMTP;
@@ -1207,7 +1241,8 @@ sub send_message {
 				$smtp->command('STARTTLS');
 				$smtp->response();
 				if ($smtp->code == 220) {
-					$smtp = Net::SMTP::SSL->start_SSL($smtp)
+					$smtp = Net::SMTP::SSL->start_SSL($smtp,
+									  ssl_verify_params())
 						or die "STARTTLS failed! ".$smtp->message;
 					$smtp_encryption = '';
 					# Send EHLO again to receive fresh
-- 
1.8.3.3-992-gf0e5e44

^ permalink raw reply related	[relevance 55%]

* [PATCH v2] git-send-email: honor $PATH for sendmail binary
  @ 2017-11-18 22:20 55% ` Florian Klink
  0 siblings, 0 replies; 200+ results
From: Florian Klink @ 2017-11-18 22:20 UTC (permalink / raw)
  To: git; +Cc: flokli, sandals

This extends git-send-email to also consider sendmail binaries in $PATH,
in addition to the (fixed) list of /usr/sbin and /usr/lib.fixed) list of
paths.

Signed-off-by: Florian Klink <flokli@flokli.de>
---
 Documentation/git-send-email.txt | 6 +++---
 git-send-email.perl              | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index bac9014ac..7af48f8eb 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -203,9 +203,9 @@ a password is obtained using 'git-credential'.
 	specify a full pathname of a sendmail-like program instead;
 	the program must support the `-i` option.  Default value can
 	be specified by the `sendemail.smtpServer` configuration
-	option; the built-in default is `/usr/sbin/sendmail` or
-	`/usr/lib/sendmail` if such program is available, or
-	`localhost` otherwise.
+	option; the built-in default is to search in $PATH,
+	then /usr/sbin and /usr/lib/sendmail afterwards if such program
+	is available, falling back to `localhost` otherwise.
 
 --smtp-server-port=<port>::
 	Specifies a port different from the default port (SMTP
diff --git a/git-send-email.perl b/git-send-email.perl
index 2208dcc21..570f04079 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -885,7 +885,9 @@ if (defined $initial_reply_to) {
 }
 
 if (!defined $smtp_server) {
-	foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
+	my @sendmail_paths = map {"$_/sendmail"} split /:/, $ENV{PATH};
+	push @sendmail_paths, qw( /usr/sbin/sendmail /usr/lib/sendmail );
+	foreach (@sendmail_paths) {
 		if (-x $_) {
 			$smtp_server = $_;
 			last;
-- 
2.15.0


^ permalink raw reply related	[relevance 55%]

* [PATCH 2/2] git-send-email: Read the default SMTP server from the GIT config file
  @ 2006-10-29 19:31 55% ` Sergey Vlasov
  0 siblings, 0 replies; 200+ results
From: Sergey Vlasov @ 2006-10-29 19:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ryan Anderson, git, Sergey Vlasov

Make the default value for --smtp-server configurable through the
'sendemail.smtpserver' option in .git/config (or $HOME/.gitconfig).

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
---
 Documentation/git-send-email.txt |    8 +++++---
 git-send-email.perl              |    3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index ec0e201..4c8d907 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -68,9 +68,11 @@ The options available are:
 --smtp-server::
 	If set, specifies the outgoing SMTP server to use.  A full
 	pathname of a sendmail-like program can be specified instead;
-	the program must support the `-i` option.  Defaults to
-	`/usr/sbin/sendmail` or `/usr/lib/sendmail` if such program is
-	available, or to `localhost` otherwise.
+	the program must support the `-i` option.  Default value can
+	be specified by the 'sendemail.smtpserver' configuration
+	option; the built-in default is `/usr/sbin/sendmail` or
+	`/usr/lib/sendmail` if such program is available, or
+	`localhost` otherwise.
 
 --subject::
    	Specify the initial subject of the email thread.
diff --git a/git-send-email.perl b/git-send-email.perl
index c42dc3b..4c87c20 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -231,6 +231,9 @@ if (!defined $initial_reply_to && $promp
 }
 
 if (!$smtp_server) {
+	$smtp_server = $repo->config('sendemail.smtpserver');
+}
+if (!$smtp_server) {
 	foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
 		if (-x $_) {
 			$smtp_server = $_;
-- 
1.4.3.3.ge502

^ permalink raw reply related	[relevance 55%]

* [PATCH 2/3] git send-email: interpret unknown files as revision lists
  @ 2008-10-31 10:57 55%   ` Pierre Habouzit
  0 siblings, 0 replies; 200+ results
From: Pierre Habouzit @ 2008-10-31 10:57 UTC (permalink / raw)
  To: git; +Cc: Pierre Habouzit

Instead of skipping unkown files on the command line, pass them through
git format-patch into a safe temporary directory. This allow no
complicated rev-list option lists combining "--all" "--not" and so on, but
allow to use ranges which are quite enough for most of the use cases.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
 Documentation/git-send-email.txt |    2 +-
 git-send-email.perl              |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 82f5056..cafff1a 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -8,7 +8,7 @@ git-send-email - Send a collection of patches as emails
 
 SYNOPSIS
 --------
-'git send-email' [options] <file|directory> [... file|directory]
+'git send-email' [options] <file|directory|rev-list>...
 
 
 DESCRIPTION
diff --git a/git-send-email.perl b/git-send-email.perl
index 94ca5c8..0d50ee2 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -22,6 +22,7 @@ use Term::ReadLine;
 use Getopt::Long;
 use Data::Dumper;
 use Term::ANSIColor;
+use File::Temp qw/ tempdir /;
 use Git;
 
 package FakeTerm;
@@ -38,7 +39,7 @@ package main;
 
 sub usage {
 	print <<EOT;
-git send-email [options] <file | directory>...
+git send-email [options] <file | directory | rev-list >
 
   Composing:
     --from                  <str>  * Email From:
@@ -378,7 +379,8 @@ for my $f (@ARGV) {
 	} elsif (-f $f or -p $f) {
 		push @files, $f;
 	} else {
-		print STDERR "Skipping $f - not found.\n";
+		my $tempdir = tempdir(CLEANUP => 1);
+		push @files, $repo->command('format-patch', '-o', $tempdir, $f);
 	}
 }
 
-- 
1.6.0.3.759.g40a2.dirty

^ permalink raw reply related	[relevance 55%]

* [PATCH] send-email: teach sanitize_address to do rfc2047 quoting
  @ 2007-08-06 20:34 55% ` Uwe Kleine-König
  0 siblings, 0 replies; 200+ results
From: Uwe Kleine-König @ 2007-08-06 20:34 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Uwe Kleine-König, Jakub Narebski

Without this patch I'm not able to properly send emails as I have a
non-ascii character in my name.

I removed the _rfc822 suffix from the function name as it now does more
than rfc822 quoting.

I dug through rfc822 to do the double quoting right.  Only if that is not
possible rfc2047 quoting is applied.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Cc: Jakub Narebski <jnareb@gmail.com>
---
As Jakub critizied now the "easiest" quoting is done.

 git-send-email.perl |   39 +++++++++++++++++++++++++++++----------
 1 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index f43f92f..39e433b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -289,7 +289,7 @@ sub expand_aliases {
 }
 
 @to = expand_aliases(@to);
-@to = (map { sanitize_address_rfc822($_) } @to);
+@to = (map { sanitize_address($_) } @to);
 @initial_cc = expand_aliases(@initial_cc);
 @bcclist = expand_aliases(@bcclist);
 
@@ -459,22 +459,41 @@ sub unquote_rfc2047 {
 	return "$_";
 }
 
-# If an address contains a . in the name portion, the name must be quoted.
-sub sanitize_address_rfc822
+# use the simplest quoting being able to handle the recipient
+sub sanitize_address
 {
 	my ($recipient) = @_;
-	my ($recipient_name) = ($recipient =~ /^(.*?)\s+</);
-	if ($recipient_name && $recipient_name =~ /\./ && $recipient_name !~ /^".*"$/) {
-		my ($name, $addr) = ($recipient =~ /^(.*?)(\s+<.*)/);
-		$recipient = "\"$name\"$addr";
+	my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\s*(<.*)/);
+
+	if (not $recipient_name) {
+		return "$recipient";
+	}
+
+	# if recipient_name is already quoted, do nothing
+	if ($recipient_name =~ /^(".*"|=\?utf-8\?q\?.*\?=)$/) {
+		return $recipient;
+	}
+
+	# rfc2047 is needed if a non-ascii char is included
+	if ($recipient_name =~ /[^[:ascii:]]/) {
+		$recipient_name =~ s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
+		$recipient_name =~ s/(.*)/=\?utf-8\?q\?$1\?=/;
 	}
-	return $recipient;
+
+	# double quotes are needed if specials or CTLs are included
+	elsif ($recipient_name =~ /[][()<>@,;:\\".\000-\037\177]/) {
+		$recipient_name =~ s/(["\\\r])/\\$1/;
+		$recipient_name = "\"$recipient_name\"";
+	}
+
+	return "$recipient_name $recipient_addr";
+
 }
 
 sub send_message
 {
 	my @recipients = unique_email_list(@to);
-	@cc = (map { sanitize_address_rfc822($_) } @cc);
+	@cc = (map { sanitize_address($_) } @cc);
 	my $to = join (",\n\t", @recipients);
 	@recipients = unique_email_list(@recipients,@cc,@bcclist);
 	@recipients = (map { extract_valid_address($_) } @recipients);
@@ -489,7 +508,7 @@ sub send_message
 	if ($cc ne '') {
 		$ccline = "\nCc: $cc";
 	}
-	$from = sanitize_address_rfc822($from);
+	$from = sanitize_address($from);
 	make_message_id();
 
 	my $header = "From: $from
-- 
1.5.3.rc3.13.g7ab3

^ permalink raw reply related	[relevance 55%]

* [PATCH] send-email: make annotate configurable
@ 2012-04-07  0:29 55% Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2012-04-07  0:29 UTC (permalink / raw)
  To: git
  Cc: Felipe Contreras, Yann Dirson, Michael Witten, Ryan Anderson,
	Michael Witten, Matthieu Moy, Adam Roben

Some people always do --annotate, lets not force them to always type
that.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/config.txt         |    1 +
 Documentation/git-send-email.txt |    5 +++--
 git-send-email.perl              |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index c081657..90c9e1b 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1828,6 +1828,7 @@ sendemail.<identity>.*::
 
 sendemail.aliasesfile::
 sendemail.aliasfiletype::
+sendemail.annotate::
 sendemail.bcc::
 sendemail.cc::
 sendemail.cccmd::
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3241170..2106fea 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -45,8 +45,9 @@ Composing
 ~~~~~~~~~
 
 --annotate::
-	Review and edit each patch you're about to send. See the
-	CONFIGURATION section for 'sendemail.multiedit'.
+	Review and edit each patch you're about to send. Default is the value
+	of 'sendemail.annotate'. See the CONFIGURATION section for
+	'sendemail.multiedit'.
 
 --bcc=<address>::
 	Specify a "Bcc:" value for each email. Default is the value of
diff --git a/git-send-email.perl b/git-send-email.perl
index ef30c55..6ef2d34 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -210,7 +210,8 @@ my %config_bool_settings = (
     "signedoffbycc" => [\$signed_off_by_cc, undef],
     "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
     "validate" => [\$validate, 1],
-    "multiedit" => [\$multiedit, undef]
+    "multiedit" => [\$multiedit, undef],
+    "annotate" => [\$annotate, undef]
 );
 
 my %config_settings = (
-- 
1.7.10

^ permalink raw reply related	[relevance 55%]

* [PATCH] Add parsing of elm aliases to git-send-email
@ 2009-04-22 13:41 56% Bill Pemberton
  0 siblings, 0 replies; 200+ results
From: Bill Pemberton @ 2009-04-22 13:41 UTC (permalink / raw)
  To: git; +Cc: gitster, Bill Pemberton

elm stores a text file version of the aliases that is
<alias> = <comment> = <email address>

This adds the parsing of this file to git-send-email

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
---

I'm probably the only one that still uses elm, but hey, it's an easy 
parser to add.

 Documentation/git-send-email.txt |    2 +-
 git-send-email.perl              |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 0b1f183..794224b 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -262,7 +262,7 @@ sendemail.aliasesfile::
 
 sendemail.aliasfiletype::
 	Format of the file(s) specified in sendemail.aliasesfile. Must be
-	one of 'mutt', 'mailrc', 'pine', or 'gnus'.
+	one of 'mutt', 'mailrc', 'pine', 'elm', or 'gnus'.
 
 sendemail.multiedit::
 	If true (default), a single editor instance will be spawned to edit
diff --git a/git-send-email.perl b/git-send-email.perl
index 172b53c..c08d40c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -418,6 +418,14 @@ my %parse_alias = (
 			$x =~ /^(\S+)$f\t\(?([^\t]+?)\)?(:?$f){0,2}$/ or next;
 			$aliases{$1} = [ split_addrs($2) ];
 		}},
+        elm => sub  { my $fh = shift;
+	              while (<$fh>) {
+			  if (/^(\S+)\s+=\s+[^=]+=\s(\S+)/) {
+			      my ($alias, $addr) = ($1, $2);
+			       $aliases{$alias} = [ split_addrs($addr) ];
+			  }
+		      } },
+
 	gnus => sub { my $fh = shift; while (<$fh>) {
 		if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
 			$aliases{$1} = [ $2 ];
-- 
1.6.0.6

^ permalink raw reply related	[relevance 56%]

* [PATCH] send-email: let sanitize_address_rfc822 do rfc2047 quoting
@ 2007-08-05 20:09 56% Uwe Kleine-König
  0 siblings, 0 replies; 200+ results
From: Uwe Kleine-König @ 2007-08-05 20:09 UTC (permalink / raw)
  To: git; +Cc: Uwe Kleine-König

Without this patch I'm not able to properly send emails as I have a
non-ascii character in my name.

The former version tried to fix-up the real name part with double quotes
if it includes a '.'.  I removed this as rfc2047 can handle a dot, too.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
---
Hello,

I already sent a similar patch that was discussed a bit[1], but was not taken.

The list of allowed character was taken from Python's email package.

Comparing with the former version I removed the quoting as described in
the 2nd paragraph of the log and now I only test $recipient_name once.

I will try to send this patch with next + this patch.  I think it should
work in principle, but --suppress-from is not honored.  I will take a
look on this issue later.

Best regards
Uwe

[1] http://thread.gmane.org/gmane.comp.version-control.git/52093

 git-send-email.perl |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index f43f92f..5785e29 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -459,16 +459,27 @@ sub unquote_rfc2047 {
 	return "$_";
 }
 
-# If an address contains a . in the name portion, the name must be quoted.
+# The name part of an address must consist only of alnum chars, space and a few
+# others.
+# If it contains a "forbidden" char in the name port, quote it according to
+# rfc2047.
 sub sanitize_address_rfc822
 {
 	my ($recipient) = @_;
-	my ($recipient_name) = ($recipient =~ /^(.*?)\s+</);
-	if ($recipient_name && $recipient_name =~ /\./ && $recipient_name !~ /^".*"$/) {
-		my ($name, $addr) = ($recipient =~ /^(.*?)(\s+<.*)/);
-		$recipient = "\"$name\"$addr";
+	my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)(\s+<.*)/);
+
+	if ($recipient_name) {
+		if ($recipient_name =~ /[^-a-zA-Z0-9!*+\/ ]/ && $recipient_name !~ /=\?utf-8\?q?.*\?=/) {
+			$recipient_name =~ s/([^-a-zA-Z0-9!*+\/ ])/sprintf("=%02X", ord($1))/eg;
+			$recipient_name =~ s/ /_/;
+			$recipient_name =~ s/(.*)/=\?utf-8\?q\?$1\?=/;
+		}
+
+		return "$recipient_name$recipient_addr";
+
+	} else {
+		return "$recipient";
 	}
-	return $recipient;
 }
 
 sub send_message
-- 
1.5.3.rc3.13.g7ab3

^ permalink raw reply related	[relevance 56%]

* [PATCH/RFC] perl: bump the required Perl version to 5.8 from 5.6.[21]
    2010-09-24 20:00 61% ` [PATCH] perl: use "use warnings" instead of -w Ævar Arnfjörð Bjarmason
@ 2010-09-24 20:00 56% ` Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-24 20:00 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jakub Narebski, Tor Arntsen, Randal L. Schwartz,
	Ævar Arnfjörð Bjarmason

Formalize our dependency on perl 5.8, bumped from 5.6.[12]. We already
used the three-arg form of open() which was introduced in 5.6.1, but
t/t9700/test.pl explicitly depended on 5.6.2.

However git-add--interactive.pl has been failing on the 5.6 line since
it was introduced in v1.5.0-rc0~12^2~2 back in 2006 due to this open
syntax:

    sub run_cmd_pipe {
           my $fh = undef;
           open($fh, '-|', @_) or die;
           return <$fh>;
    }

Which when executed dies on "Can't use an undefined value as
filehandle reference". Several of our tests also fail on 5.6 (even
more when compiled with NO_PERL_MAKEMAKER=1):

    t2016-checkout-patch.sh
    t3904-stash-patch.sh
    t3701-add-interactive.sh
    t7105-reset-patch.sh
    t7501-commit.sh
    t9700-perl-git.sh

Our code is bitrotting on 5.6 with no-one interested in fixing it, and
pinning us to such an ancient release of Perl is keeping us from using
useful features introduced in the 5.8 release.

The 5.6 series is now over 10 years old, and the 5.6.2 maintenance
release almost 7. 5.8 on the other hand is more than 8 years old.

All the modern Unix-like operating systems have now upgraded to it or
a later version, and 5.8 packages are available for old IRIX, AIX
Solaris and Tru64 systems.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Tor Arntsen <tor@spacetec.no>
Acked-by: Randal L. Schwartz <merlyn@stonehenge.com>
---

A follow-up to the discussion in "Let's bump the minimum Perl version
to 5.8". I took the liberty of adding Tor and Randal's Acked-by to the
patch based on their comments in the thread. Which is why this is an
RFC, if they're OK with it it can be applied.

 INSTALL                    |    8 ++++----
 git-add--interactive.perl  |    1 +
 git-archimport.perl        |    1 +
 git-cvsexportcommit.perl   |    1 +
 git-cvsimport.perl         |    1 +
 git-cvsserver.perl         |    1 +
 git-difftool.perl          |    1 +
 git-relink.perl            |    2 +-
 git-send-email.perl        |    1 +
 git-svn.perl               |    1 +
 gitweb/gitweb.perl         |    1 +
 perl/Git.pm                |    1 +
 t/t7006/test-terminal.perl |    1 +
 t/t9700/test.pl            |    2 +-
 14 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/INSTALL b/INSTALL
index 59200b7..10a1cba 100644
--- a/INSTALL
+++ b/INSTALL
@@ -67,10 +67,10 @@ Issues of note:
 	- A POSIX-compliant shell is required to run many scripts needed
 	  for everyday use (e.g. "bisect", "pull").
 
-	- "Perl" is needed to use some of the features (e.g. preparing a
-	  partial commit using "git add -i/-p", interacting with svn
-	  repositories with "git svn").  If you can live without these, use
-	  NO_PERL.
+	- "Perl" version 5.8 or later is needed to use some of the
+	  features (e.g. preparing a partial commit using "git add -i/-p",
+	  interacting with svn repositories with "git svn").  If you can
+	  live without these, use NO_PERL.
 
 	- "openssl" library is used by git-imap-send to use IMAP over SSL.
 	  If you don't need it, use NO_OPENSSL.
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 27fc793..a96fb53 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1,5 +1,6 @@
 #!/usr/bin/perl -w
 
+use 5.008;
 use strict;
 use Git;
 
diff --git a/git-archimport.perl b/git-archimport.perl
index 98f3ede..947638c 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -54,6 +54,7 @@ and can contain multiple, unrelated branches.
 
 =cut
 
+use 5.008;
 use strict;
 use warnings;
 use Getopt::Std;
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 59b6722..9a8188b 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -1,5 +1,6 @@
 #!/usr/bin/perl -w
 
+use 5.008;
 use strict;
 use Getopt::Std;
 use File::Temp qw(tempdir);
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 9e03eee..53869fb 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -13,6 +13,7 @@
 # The head revision is on branch "origin" by default.
 # You can change that with the '-o' option.
 
+use 5.008;
 use strict;
 use warnings;
 use Getopt::Long;
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index e9f3037..2822bed 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -15,6 +15,7 @@
 ####
 ####
 
+use 5.008;
 use strict;
 use warnings;
 use bytes;
diff --git a/git-difftool.perl b/git-difftool.perl
index adc42de..e95e4ad 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -10,6 +10,7 @@
 #
 # Any arguments that are unknown to this script are forwarded to 'git diff'.
 
+use 5.008;
 use strict;
 use warnings;
 use Cwd qw(abs_path);
diff --git a/git-relink.perl b/git-relink.perl
index 937c69a..af2e305 100755
--- a/git-relink.perl
+++ b/git-relink.perl
@@ -6,7 +6,7 @@
 #
 # Scan two git object-trees, and hardlink any common objects between them.
 
-use 5.006;
+use 5.008;
 use strict;
 use warnings;
 use Getopt::Long;
diff --git a/git-send-email.perl b/git-send-email.perl
index 6dab3bf..314e59e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -16,6 +16,7 @@
 #    and second line is the subject of the message.
 #
 
+use 5.008;
 use strict;
 use warnings;
 use Term::ReadLine;
diff --git a/git-svn.perl b/git-svn.perl
index 9b046b6..d292224 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1,6 +1,7 @@
 #!/usr/bin/env perl
 # Copyright (C) 2006, Eric Wong <normalperson@yhbt.net>
 # License: GPL v2 or later
+use 5.008;
 use warnings;
 use strict;
 use vars qw/	$AUTHOR $VERSION
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a85e2f6..e645d4a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -7,6 +7,7 @@
 #
 # This program is licensed under the GPLv2
 
+use 5.008;
 use strict;
 use warnings;
 use CGI qw(:standard :escapeHTML -nosticky);
diff --git a/perl/Git.pm b/perl/Git.pm
index 6cb0dd1..205e48a 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -7,6 +7,7 @@ Git - Perl interface to the Git version control system
 
 package Git;
 
+use 5.008;
 use strict;
 
 
diff --git a/t/t7006/test-terminal.perl b/t/t7006/test-terminal.perl
index 73ff809..6b5f22a 100755
--- a/t/t7006/test-terminal.perl
+++ b/t/t7006/test-terminal.perl
@@ -1,4 +1,5 @@
 #!/usr/bin/perl
+use 5.008;
 use strict;
 use warnings;
 use IO::Pty;
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 671f38d..c15ca2d 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use lib (split(/:/, $ENV{GITPERLLIB}));
 
-use 5.006002;
+use 5.008;
 use warnings;
 use strict;
 
-- 
1.7.3.256.g00e8a

^ permalink raw reply related	[relevance 56%]

* [PATCH v2 2/3] git-send-email: die on invalid smtp_encryption
  @ 2021-04-11 12:54 56% ` Drew DeVault
  2021-04-11 12:54 51% ` [PATCH v2 3/3] git-send-email: rename 'tls' to 'starttls' Drew DeVault
  1 sibling, 0 replies; 200+ results
From: Drew DeVault @ 2021-04-11 12:54 UTC (permalink / raw)
  To: git; +Cc: Drew DeVault

Signed-off-by: Drew DeVault <sir@cmpwn.com>
---
 Documentation/git-send-email.txt | 4 ++--
 git-send-email.perl              | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index c17c3b400a..520b355e50 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -171,8 +171,8 @@ Sending
 	Specify the encryption to use, either 'ssl' or 'tls'. 'ssl' enables
 	generic SSL/TLS support and is typically used on port 465.  'tls'
 	enables in-band STARTTLS support and is typically used on port 25 or
-	587.  Use whichever option is recommended by your mail provider.  Any
-	other value reverts to plain SMTP.  Default is the value of
+	587.  Use whichever option is recommended by your mail provider.  Leave
+	empty to disable encryption and use plain SMTP.  Default is the value of
 	`sendemail.smtpEncryption`.
 
 --smtp-domain=<FQDN>::
diff --git a/git-send-email.perl b/git-send-email.perl
index f5bbf1647e..bda5211f0d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -495,6 +495,9 @@ sub read_config {
 
 # 'default' encryption is none -- this only prevents a warning
 $smtp_encryption = '' unless (defined $smtp_encryption);
+if ($smtp_encryption ne "" && $smtp_encryption ne "ssl" && $smtp_encryption ne "tls") {
+	die __("Invalid smtp_encryption configuration: expected 'ssl', 'tls', or nothing.\n");
+}
 
 # Set CC suppressions
 my(%suppress_cc);
-- 
2.31.1


^ permalink raw reply related	[relevance 56%]

* [PATCH] Shorten and simplify sendemail.alias* configuration variables.
@ 2008-03-17 22:53 56% Xavier Maillard
  0 siblings, 0 replies; 200+ results
From: Xavier Maillard @ 2008-03-17 22:53 UTC (permalink / raw)
  To: git

I find it more consistent and less error prone to have aliasfile
instead of aliasesfile and aliastype instead of aliasfiletype.

Documentation is also updated to reflect the changes.

Signed-off-by: Xavier Maillard <xma@gnu.org>
---
 Documentation/git-send-email.txt |    8 ++++----
 git-send-email.perl              |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 336d797..33fd589 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -192,12 +192,12 @@ sendemail.identity::
 	identities and to hoist sensitive authentication information
 	out of the repository and into the global configuration file.
 
-sendemail.aliasesfile::
+sendemail.aliasfile::
 	To avoid typing long email addresses, point this to one or more
-	email aliases files.  You must also supply 'sendemail.aliasfiletype'.
+	email aliases files.  You must also supply 'sendemail.aliastype'.
 
-sendemail.aliasfiletype::
-	Format of the file(s) specified in sendemail.aliasesfile. Must be
+sendemail.aliastype::
+	Format of the file(s) specified in sendemail.aliasfile. Must be
 	one of 'mutt', 'mailrc', 'pine', or 'gnus'.
 
 sendemail.to::
diff --git a/git-send-email.perl b/git-send-email.perl
index be4a20d..1d8bb8e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -203,9 +203,9 @@ my %config_settings = (
     "smtppass" => \$smtp_authpass,
     "to" => \@to,
     "cccmd" => \$cc_cmd,
-    "aliasfiletype" => \$aliasfiletype,
+    "aliastype" => \$aliasfiletype,
     "bcc" => \@bcclist,
-    "aliasesfile" => \@alias_files,
+    "aliasfile" => \@alias_files,
     "suppresscc" => \@suppress_cc,
 );
 
-- 
1.5.4.4.685.g64f14.dirty

^ permalink raw reply related	[relevance 56%]

* [PATCH v2 1/2] send-email: update the mechanism to set default  configuration values
    2019-05-08 10:56 60% ` [PATCH v2 2/2] send-email: honor transferencoding config option again Junio C Hamano
@ 2019-05-08 10:56 56% ` Junio C Hamano
  1 sibling, 0 replies; 200+ results
From: Junio C Hamano @ 2019-05-08 10:56 UTC (permalink / raw)
  To: git; +Cc: Heinrich Schuchardt, Brian M Carlson, Jonathan Nieder

The program has a good mechanism to specify the fallback default
values for boolean configuration variables after two invocations of
read_config() for "sendmail.$ident.$var" and "sendemail.$var" have
not found any configuration.  Imitate it so that we can set the
default values for non-boolean variables as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-send-email.perl | 56 ++++++++++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 23 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index f4c07908d2..98bc295c6e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -250,28 +250,28 @@ sub do_edit {
 );
 
 my %config_settings = (
-    "smtpserver" => \$smtp_server,
-    "smtpserverport" => \$smtp_server_port,
-    "smtpserveroption" => \@smtp_server_options,
-    "smtpuser" => \$smtp_authuser,
-    "smtppass" => \$smtp_authpass,
-    "smtpdomain" => \$smtp_domain,
-    "smtpauth" => \$smtp_auth,
-    "smtpbatchsize" => \$batch_size,
-    "smtprelogindelay" => \$relogin_delay,
-    "to" => \@initial_to,
-    "tocmd" => \$to_cmd,
-    "cc" => \@initial_cc,
-    "cccmd" => \$cc_cmd,
-    "aliasfiletype" => \$aliasfiletype,
-    "bcc" => \@bcclist,
-    "suppresscc" => \@suppress_cc,
-    "envelopesender" => \$envelope_sender,
-    "confirm"   => \$confirm,
-    "from" => \$sender,
-    "assume8bitencoding" => \$auto_8bit_encoding,
-    "composeencoding" => \$compose_encoding,
-    "transferencoding" => \$target_xfer_encoding,
+    "smtpserver" => [\$smtp_server],
+    "smtpserverport" => [\$smtp_server_port],
+    "smtpserveroption" => [\@smtp_server_options],
+    "smtpuser" => [\$smtp_authuser],
+    "smtppass" => [\$smtp_authpass],
+    "smtpdomain" => [\$smtp_domain],
+    "smtpauth" => [\$smtp_auth],
+    "smtpbatchsize" => [\$batch_size],
+    "smtprelogindelay" => [\$relogin_delay],
+    "to" => [\@initial_to],
+    "tocmd" => [\$to_cmd],
+    "cc" => [\@initial_cc],
+    "cccmd" => [\$cc_cmd],
+    "aliasfiletype" => [\$aliasfiletype],
+    "bcc" => [\@bcclist],
+    "suppresscc" => [\@suppress_cc],
+    "envelopesender" => [\$envelope_sender],
+    "confirm"   => [\$confirm],
+    "from" => [\$sender],
+    "assume8bitencoding" => [\$auto_8bit_encoding],
+    "composeencoding" => [\$compose_encoding],
+    "transferencoding" => [\$target_xfer_encoding],
 );
 
 my %config_path_settings = (
@@ -411,7 +411,7 @@ sub read_config {
 	}
 
 	foreach my $setting (keys %config_settings) {
-		my $target = $config_settings{$setting};
+		my $target = $config_settings{$setting}->[0];
 		next if $setting eq "to" and defined $no_to;
 		next if $setting eq "cc" and defined $no_cc;
 		next if $setting eq "bcc" and defined $no_bcc;
@@ -446,6 +446,16 @@ sub read_config {
 	${$setting->[0]} = $setting->[1] unless (defined (${$setting->[0]}));
 }
 
+# fall back to builtin defaults
+while (my ($name, $setting) = each %config_settings) {
+	next unless @$setting == 2;
+
+	my ($target, $default) = @$setting;
+	if (ref($target) eq "SCALAR") {
+		$$target = $default unless defined $$target;
+	} # elsif ... for other types later.
+}
+
 # 'default' encryption is none -- this only prevents a warning
 $smtp_encryption = '' unless (defined $smtp_encryption);
 
-- 
2.21.0-777-g83232e3864


^ permalink raw reply related	[relevance 56%]

* Re: send-email: Net::SMTP::SSL failure
  @ 2017-06-07 19:30 56%       ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2017-06-07 19:30 UTC (permalink / raw)
  To: Liam Breck; +Cc: Git Mailing List

On Wed, Jun 7, 2017 at 8:04 PM, Liam Breck <liam@networkimprov.net> wrote:
> Thanks for your help!
>
> On Wed, Jun 7, 2017 at 10:16 AM, Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>> On Wed, Jun 7, 2017 at 7:00 PM, Liam Breck <liam@networkimprov.net> wrote:
>>> On Tue, Jun 6, 2017 at 10:47 PM, Liam Breck <liam@networkimprov.net> wrote:
>>>>
>>>> This is configured to send via a gmail account
>>>> git send-email --to-cover --cc-cover <patch-list>
>>>>
>>>> I See
>>>> Attempt to reload IO/Socket/SSL.pm aborted.
>>>> Compilation failed in require at
>>>> /usr/share/perl5/vendor_perl/Net/SMTP/SSL.pm line 6.
>>>> BEGIN failed--compilation aborted at
>>>> /usr/share/perl5/vendor_perl/Net/SMTP/SSL.pm line 6.
>>>> Compilation failed in require at /usr/lib/git-core/git-send-email line 1386.
>>>> fatal: 'send-email' appears to be a git command, but we were not
>>>> able to execute it. Maybe git-send-email is broken?
>>>>
>>>> Net/SMTP/SSL.pm v1.04
>>>>
>>>> perl v5.26.0
>>>>
>>>> Seen in git 2.11.1, 2.12.2, 2.13.0, 2.13.1 on Arch Linux
>>>
>>> Also fails with perl 5.24.1 & 5.24.0
>>>
>>> Last working config was git 2.9.3 on perl 5.24.1
>>>
>>> The relevant code from git-send-email is:
>>>
>>>             require Net::SMTP;
>>>             $smtp_domain ||= maildomain();
>>>             $smtp_server_port ||= 25;
>>>             $smtp ||= Net::SMTP->new($smtp_server,
>>>                          Hello => $smtp_domain,
>>>                          Debug => $debug_net_smtp,
>>>                          Port => $smtp_server_port);
>>>             if ($smtp_encryption eq 'tls' && $smtp) {
>>>                 require Net::SMTP::SSL;
>>>                 $smtp->command('STARTTLS');
>>>
>>> I really wish git bundled its non-core perl libs...
>>
>> What's the output from just:
>>
>>     perl -MNet::SMTP -we1
>
> No output, exit code 0, however...
>
> $ perl -MIO::Socket::SSL -we1
> Can't load '/usr/lib/perl5/site_perl/auto/Net/SSLeay/SSLeay.so' for
> module Net::SSLeay: libssl.so.1.0.0: cannot open shared object file:
> No such file or directory at /usr/lib/perl5/core_perl/DynaLoader.pm
> line 193.
> at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm line 19.
> Compilation failed in require at
> /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm line 19.
> BEGIN failed--compilation aborted at
> /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm line 19.
> Compilation failed in require.
> BEGIN failed--compilation aborted.
>
> I don't have {vendor,site}_perl/auto/ tho I have the package for
> ssleay installed.
>
> Since which git release was that required?

The actual issue here is that your Net::SSLeay package is broken
because it's linked to libssl.so.1.0.0 which has since gone away. You
should see that it's missing if you run whatever the Arch equivalent
is of these Debian commands:

    $ dpkg -L libnet-ssleay-perl|grep \.so$
    /usr/lib/x86_64-linux-gnu/perl5/5.24/auto/Net/SSLeay/SSLeay.so
    $ /usr/bin/perldoc -l Net::SSLeay
    /usr/lib/x86_64-linux-gnu/perl5/5.24/Net/SSLeay.pod
    $ dpkg -S /usr/lib/x86_64-linux-gnu/perl5/5.24/Net/SSLeay.pod
    libnet-ssleay-perl: /usr/lib/x86_64-linux-gnu/perl5/5.24/Net/SSLeay.pod
    $ dpkg -L libnet-ssleay-perl|grep \.so$
    /usr/lib/x86_64-linux-gnu/perl5/5.24/auto/Net/SSLeay/SSLeay.so
    $ ldd -r /usr/lib/x86_64-linux-gnu/perl5/5.24/auto/Net/SSLeay/SSLeay.so
2>&1|grep libssl
            libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
(0x00007f2523bb5000)
    $ dpkg -S /usr/lib/x86_64-linux-gnu/libssl.so.1.1
    libssl1.1:amd64: /usr/lib/x86_64-linux-gnu/libssl.so.1.1

But that this isn't reported is a bug in git-send-email. This
(untested) patch is probably the least invasive and easiest way to
deal with this:

diff --git a/git-send-email.perl b/git-send-email.perl
index 7fd5874436..3f0fcf9040 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1354,6 +1354,8 @@ EOF
                        die __("The required SMTP server is not
properly defined.")
                }

+               delete $INC{"Net/SMTP.pm"} if exists $INC{"Net/SMTP.pm"}
+                                             and !defined $INC{"Net/SMTP.pm"};
                require Net::SMTP;
                my $use_net_smtp_ssl =
version->parse($Net::SMTP::VERSION) < version->parse("2.34");
                $smtp_domain ||= maildomain();

on closer inspection none of the other require() uses in that script
are run twice, so they don't have the same issue with hiding the
initial error.


>> I have not looked deeply at this, but the error you're getting means
>> "we tried to load it before and failed, and here you are trying
>> again".
>>
>> This is almost definitely due to this line in git-send-email:
>>
>>         if (eval { require Net::SMTP; 1 }) {
>>
>> And more generally, this code is all buggy:
>>
>>     4 matches for "eval.*require" in buffer: git-send-email.perl
>>     153:my $have_email_valid = eval { require Email::Valid; 1 };
>>     154:my $have_mail_address = eval { require Mail::Address; 1 };
>>    1118:        if (eval { require Net::Domain; 1 }) {
>>    1129:        if (eval { require Net::SMTP; 1 }) {
>>
>> Well, "buggy" in the sense that we're just happy-go-lucky trying to
>> load these modules, and if they have an error we don't report it, then
>> when we try to load them again perl just emits a generic error saying
>> you're trying to require() something that already failed somewhere
>> before, a minimal test case for that is:
>>
>>     $ cat /tmp/Fails.pm
>>     package Fails;
>>     die "oh noes";
>>     $ perl -I/tmp -we 'eval { require Fails }; require Fails'
>>     Attempt to reload Fails.pm aborted.
>>     Compilation failed in require at -e line 1.
>>
>> Whereas what we really want to do is some variant of:
>>
>>     $ perl -MData::Dumper -I/tmp -we 'eval { require Fails } or warn
>> $@; require Fails'
>>     oh noes at /tmp/Fails.pm line 2.
>>     Compilation failed in require at -e line 1.
>>     Attempt to reload Fails.pm aborted.
>>     Compilation failed in require at -e line 1.
>>
>> Or even the more adventerous, this can have some bad side-effects with
>> some libraries (you lie to perl saying you haven't seen it before),
>> but I doubt Net::SMTP cares much, particularly when we're just about
>> to report an error:
>>
>>     $ perl -MData::Dumper -I/tmp -we 'eval { require Fails } or do {
>> delete $INC{"Fails.pm"} }; require Fails'
>>     oh noes at /tmp/Fails.pm line 2.
>>     Compilation failed in require at -e line 1.

^ permalink raw reply related	[relevance 56%]

* [PATCH/RFC v2 5/6] gettext: Add a Gettext interface for Perl
  @ 2010-05-30 20:54 56% ` Ævar Arnfjörð Bjarmason
  2010-06-01 23:39 55% ` [PATCH/RFC v3 3/7] " Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-05-30 20:54 UTC (permalink / raw)
  To: git; +Cc: Jeff Epler, Ævar Arnfjörð Bjarmason

Make Git's gettext messages available to Perl programs through
Locale::Messages. Gracefully fall back to English on systems that
don't contain the module.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile            |    4 ++-
 git-send-email.perl |    3 +-
 perl/Git/Gettext.pm |   83 +++++++++++++++++++++++++++++++++++++++++++++++++++
 perl/Makefile.PL    |    5 ++-
 4 files changed, 92 insertions(+), 3 deletions(-)
 create mode 100644 perl/Git/Gettext.pm

diff --git a/Makefile b/Makefile
index dce2faa..2101713 100644
--- a/Makefile
+++ b/Makefile
@@ -1884,7 +1884,9 @@ cscope:
 	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
 
 pot:
-	$(XGETTEXT) -k_ -o po/git.pot $(C_OBJ:o=c) $(SCRIPT_SH)
+	$(XGETTEXT) --keyword=_ --output=po/git.pot --language=C $(C_OBJ:o=c)
+	$(XGETTEXT) --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH)
+	$(XGETTEXT) --join-existing --output=po/git.pot --language=Perl $(SCRIPT_PERL)
 
 POFILES := $(wildcard po/*.po)
 MOFILES := $(patsubst po/%.po,share/locale/%/LC_MESSAGES/git.mo,$(POFILES))
diff --git a/git-send-email.perl b/git-send-email.perl
index 111c981..a36718e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -26,6 +26,7 @@ use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
 use Error qw(:try);
 use Git;
+use Git::Gettext qw< :all >;
 
 Getopt::Long::Configure qw/ pass_through /;
 
@@ -674,7 +675,7 @@ if (!defined $sender) {
 	$sender = $repoauthor || $repocommitter || '';
 	$sender = ask("Who should the emails appear to be from? [$sender] ",
 	              default => $sender);
-	print "Emails will be sent from: ", $sender, "\n";
+	printf gettext("Emails will be sent from: %s\n"), $sender;
 	$prompting++;
 }
 
diff --git a/perl/Git/Gettext.pm b/perl/Git/Gettext.pm
new file mode 100644
index 0000000..f434783
--- /dev/null
+++ b/perl/Git/Gettext.pm
@@ -0,0 +1,83 @@
+package Git::Gettext;
+use strict;
+use warnings;
+use Exporter;
+use base 'Exporter';
+
+our $VERSION = '0.01';
+
+our @EXPORT;
+our @EXPORT_OK = qw< gettext >;
+our %EXPORT_TAGS;
+@{ $EXPORT_TAGS{'all'} } = @EXPORT_OK;
+
+sub __bootstrap_locale_messages {
+	our $TEXTDOMAIN = 'git';
+
+	# TODO: How do I make the sed replacements in the top level
+	# Makefile reach me here?
+	#our $TEXTDOMAINDIR = q|@@LOCALEDIR@@|;
+	our $TEXTDOMAINDIR = q</usr/local/share/locale>;
+
+	require POSIX;
+	POSIX->import(qw< setlocale >);
+	# Non-core prerequisite module
+	require Locale::Messages;
+	Locale::Messages->import(qw< :locale_h :libintl_h >);
+
+	setlocale(LC_MESSAGES(), '');
+	setlocale(LC_CTYPE(), '');
+	textdomain($TEXTDOMAIN);
+	bindtextdomain($TEXTDOMAIN => $TEXTDOMAINDIR);
+
+	return;
+}
+
+BEGIN
+{
+	local ($@, $!);
+	eval { __bootstrap_locale_messages() };
+	if ($@) {
+		# Oh noes, no Locale::Messages here
+		*gettext = sub ($) { $_[0] };
+	}
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Git::Gettext - Perl interface to Git's Gettext localizations
+
+=head1 DESCRIPTION
+
+Git's internal interface to Gettext via L<Locale::Messages>. If
+L<Locale::Messages> can't be loaded (it's not a core module) we
+provide stub passthrough fallbacks.
+
+=head1 FUNCTIONS
+
+=head2 gettext($)
+
+L<Locale::Messages>'s gettext function if all goes well, otherwise our
+passthrough fallback function.
+
+=head1 EXPORTS
+
+Exports are done via L<Exporter>. Invididual functions can be
+exporter, or all of them via the C<:all> export tag.
+
+=head1 AUTHOR
+
+E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avarab@gmail.com>
+
+=head1 LICENSE AND COPYRIGHT
+
+Copyright 2010 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avarab@gmail.com>
+
+This program is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index 0b9deca..702ec7c 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -16,7 +16,10 @@ endif
 MAKE_FRAG
 }
 
-my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');
+my %pm = (
+	'Git.pm' => '$(INST_LIBDIR)/Git.pm',
+	'Git/Gettext.pm' => '$(INST_LIBDIR)/Git/Gettext.pm',
+);
 
 # We come with our own bundled Error.pm. It's not in the set of default
 # Perl modules so install it if it's not available on the system yet.
-- 
1.7.1.248.gcd6d1

^ permalink raw reply related	[relevance 56%]

* [PATCH] git-send-email: honor $PATH
@ 2017-11-18 12:42 56% Florian Klink
  0 siblings, 0 replies; 200+ results
From: Florian Klink @ 2017-11-18 12:42 UTC (permalink / raw)
  To: git; +Cc: flokli

This will search $PATH for a sendmail binary, instead of the (previously
fixed) list of paths.

Signed-off-by: Florian Klink <flokli@flokli.de>
---
 Documentation/git-send-email.txt | 5 ++---
 git-send-email.perl              | 3 ++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index bac9014ac..b9b1f2c41 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -203,9 +203,8 @@ a password is obtained using 'git-credential'.
 	specify a full pathname of a sendmail-like program instead;
 	the program must support the `-i` option.  Default value can
 	be specified by the `sendemail.smtpServer` configuration
-	option; the built-in default is `/usr/sbin/sendmail` or
-	`/usr/lib/sendmail` if such program is available, or
-	`localhost` otherwise.
+	option; the built-in default is to search in $PATH if such program is
+	available, or `localhost` otherwise.
 
 --smtp-server-port=<port>::
 	Specifies a port different from the default port (SMTP
diff --git a/git-send-email.perl b/git-send-email.perl
index 2208dcc21..8e357aeab 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -885,7 +885,8 @@ if (defined $initial_reply_to) {
 }
 
 if (!defined $smtp_server) {
-	foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) {
+	my @sendmail_paths = map {"$_/sendmail"} split /:/, $ENV{PATH};
+	foreach (@sendmail_paths) {
 		if (-x $_) {
 			$smtp_server = $_;
 			last;
-- 
2.15.0


^ permalink raw reply related	[relevance 56%]

* [PATCH] send-email: ask about and declare 8bit mails
  @ 2010-06-12 15:06 56% ` Thomas Rast
  0 siblings, 0 replies; 200+ results
From: Thomas Rast @ 2010-06-12 15:06 UTC (permalink / raw)
  To: git

git-send-email passes on an 8bit mail as-is even if it does not
declare a content-type.  Because the user can edit email between
format-patch and send-email, such invalid mails are unfortunately not
very hard to come by.

Make git-send-email stop and ask about the encoding to use if it
encounters any such mail.  Also provide a configuration setting to
permanently configure an encoding.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

This takes care of what I ran into earlier today.  However, there's
another problem: format-patch doesn't even mark the patch 8bit if its
patch contents (not log message) are non-ASCII.  I'm really not sure
what to do there.

On the practical hand, there's the problem that the entire
log_tree_commit() call chain is geared towards printing on a file, at
which time it's too late.  So we would either have to go in and fix
all of that to support formatting to a strbuf, or rewrite the patch if
it turns out to be non-ASCII.

On the philosophical hand, we don't really care about file encodings
so far, but this requires declaring one.

Either way, I think if vger doesn't accept format-patch;send-email,
something is really wrong :-)


 Documentation/git-send-email.txt |    9 ++++
 git-send-email.perl              |   59 +++++++++++++++++++++++++++++
 t/t9001-send-email.sh            |   77 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 145 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 12622fc..c283084 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -101,6 +101,15 @@ See the CONFIGURATION section for 'sendemail.multiedit'.
 +
 The --to option must be repeated for each user you want on the to list.
 
+--8bit-encoding=<encoding>::
+	When encountering a non-ASCII message or subject that does not
+	declare its encoding, add headers/quoting to indicate it is
+	encoded in <encoding>.  Default is the value of the
+	'sendemail.assume8bitEncoding'; if that is unspecified, this
+	will be prompted for if any non-ASCII files are encountered.
++
+Note that no attempts whatsoever are made to validate the encoding.
+
 
 Sending
 ~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 111c981..6b2ac79 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -54,6 +54,7 @@ git send-email [options] <file | directory | rev-list options >
     --in-reply-to           <str>  * Email "In-Reply-To:"
     --annotate                     * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
+    --8bit-encoding         <str>  * Encoding to assume 8bit mails if undeclared
 
   Sending:
     --envelope-sender       <str>  * Email envelope sender.
@@ -191,6 +192,7 @@ my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts, $smtp_domain);
 my ($validate, $confirm);
 my (@suppress_cc);
+my ($auto_8bit_encoding);
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -222,6 +224,7 @@ my %config_settings = (
     "multiedit" => \$multiedit,
     "confirm"   => \$confirm,
     "from" => \$sender,
+    "assume8bitencoding" => \$auto_8bit_encoding,
 );
 
 # Help users prepare for 1.7.0
@@ -297,6 +300,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "thread!" => \$thread,
 		    "validate!" => \$validate,
 		    "format-patch!" => \$format_patch,
+		    "8bit-encoding=s" => \$auto_8bit_encoding,
 	 );
 
 unless ($rc) {
@@ -669,6 +673,34 @@ sub ask {
 	return undef;
 }
 
+my %broken_encoding;
+
+sub file_declares_8bit_cte($) {
+	my $fn = shift;
+	open (my $fh, '<', $fn);
+	while (my $line = <$fh>) {
+		return 1 if ($line =~ /^Content-Transfer-Encoding: .*8bit.*$/);
+	}
+	close $fh;
+	return 0;
+}
+
+foreach my $f (@files) {
+	next unless (body_or_subject_has_nonascii($f)
+		     && !file_declares_8bit_cte($f));
+	$broken_encoding{$f} = 1;
+}
+
+if (!defined $auto_8bit_encoding && scalar %broken_encoding) {
+	print "The following files are 8bit, but do not declare " .
+		"a Content-Transfer-Encoding.\n";
+	foreach my $f (sort keys %broken_encoding) {
+		print "    $f\n";
+	}
+	$auto_8bit_encoding = ask("Which 8bit encoding should I declare [UTF-8]? ",
+				  default => "UTF-8");
+}
+
 my $prompting = 0;
 if (!defined $sender) {
 	$sender = $repoauthor || $repocommitter || '';
@@ -1221,6 +1253,18 @@ foreach my $t (@files) {
 			or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
 	}
 
+	if ($broken_encoding{$t} && !$has_content_type) {
+		$has_content_type = 1;
+		push @xh, "MIME-Version: 1.0",
+			"Content-Type: text/plain; charset=$auto_8bit_encoding",
+			"Content-Transfer-Encoding: 8bit";
+		$body_encoding = $auto_8bit_encoding;
+	}
+
+	if ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {
+		$subject = quote_rfc2047($subject, $auto_8bit_encoding);
+	}
+
 	if (defined $author and $author ne $sender) {
 		$message = "From: $author\n\n$message";
 		if (defined $author_encoding) {
@@ -1233,6 +1277,7 @@ foreach my $t (@files) {
 				}
 			}
 			else {
+				$has_content_type = 1;
 				push @xh,
 				  'MIME-Version: 1.0',
 				  "Content-Type: text/plain; charset=$author_encoding",
@@ -1310,3 +1355,17 @@ sub file_has_nonascii {
 	}
 	return 0;
 }
+
+sub body_or_subject_has_nonascii {
+	my $fn = shift;
+	open(my $fh, '<', $fn)
+		or die "unable to open $fn: $!\n";
+	while (my $line = <$fh>) {
+		last if $line =~ /^$/;
+		return 1 if $line =~ /^Subject.*[^[:ascii:]]/;
+	}
+	while (my $line = <$fh>) {
+		return 1 if $line =~ /[^[:ascii:]]/;
+	}
+	return 0;
+}
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 640b3d2..0b8a591 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -918,4 +918,81 @@ test_expect_success '--no-bcc overrides sendemail.bcc' '
 	! grep "RCPT TO:<other@ex.com>" stdout
 '
 
+cat >email-using-8bit <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: author@example.com
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+Subject: subject goes here
+
+Dieser deutsche Text enthält einen Umlaut!
+EOF
+
+cat >content-type-decl <<EOF
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+EOF
+
+test_expect_success 'asks about and fixes 8bit encodings' '
+	clean_fake_sendmail &&
+	echo |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			email-using-8bit >stdout &&
+	grep "do not declare a Content-Transfer-Encoding" stdout &&
+	grep email-using-8bit stdout &&
+	grep "Which 8bit encoding" stdout &&
+	grep "Content\\|MIME" msgtxt1 >actual &&
+	test_cmp actual content-type-decl
+'
+
+test_expect_success 'sendemail.8bitEncoding works' '
+	clean_fake_sendmail &&
+	git config sendemail.assume8bitEncoding UTF-8 &&
+	echo bogus |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			email-using-8bit >stdout &&
+	grep "Content\\|MIME" msgtxt1 >actual &&
+	test_cmp actual content-type-decl
+'
+
+test_expect_success '--8bit-encoding overrides sendemail.8bitEncoding' '
+	clean_fake_sendmail &&
+	git config sendemail.assume8bitEncoding "bogus too" &&
+	echo bogus |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--8bit-encoding=UTF-8 \
+			email-using-8bit >stdout &&
+	grep "Content\\|MIME" msgtxt1 >actual &&
+	test_cmp actual content-type-decl
+'
+
+cat >email-using-8bit <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: author@example.com
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+Subject: Dieser Betreff enthält auch einen Umlaut!
+
+Nothing to see here.
+EOF
+
+cat >expected <<EOF
+Subject: =?UTF-8?q?Dieser=20Betreff=20enth=C3=A4lt=20auch=20einen=20Umlaut!?=
+EOF
+
+test_expect_success '--8bit-encoding also treats subject' '
+	clean_fake_sendmail &&
+	echo bogus |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--8bit-encoding=UTF-8 \
+			email-using-8bit >stdout &&
+	grep "Subject" msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
 test_done
-- 
1.7.1.557.gd161

^ permalink raw reply related	[relevance 56%]

* [PATCH v2 1/2] send-email: align RFC 2047 decoding more closely with the spec
@ 2014-12-06 19:36 56% Роман Донченко
  2014-12-06 19:36 64% ` [PATCH v2 2/2] send-email: handle adjacent RFC 2047-encoded words properly Роман Донченко
  0 siblings, 1 reply; 200+ results
From: Роман Донченко @ 2014-12-06 19:36 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Jay Soffian, Jeff King, Thomas Rast

More specifically:

* Add "\" to the list of characters not allowed in a token (see RFC 2047
  errata).

* Share regexes between unquote_rfc2047 and is_rfc2047_quoted. Besides
  removing duplication, this also makes unquote_rfc2047 more stringent.

* Allow both "q" and "Q" to identify the encoding.

* Allow lowercase hexadecimal digits in the "Q" encoding.

And, more on the cosmetic side:

* Change the "encoded-text" regex to exclude rather than include characters,
  for clarity and consistency with "token".

Signed-off-by: Роман Донченко <dpb@corrigendum.ru>
---
 git-send-email.perl | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 9949db0..d461ffb 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -145,6 +145,11 @@ my $have_mail_address = eval { require Mail::Address; 1 };
 my $smtp;
 my $auth;
 
+# Regexes for RFC 2047 productions.
+my $re_token = qr/[^][()<>@,;:\\"\/?.= \000-\037\177-\377]+/;
+my $re_encoded_text = qr/[^? \000-\037\177-\377]+/;
+my $re_encoded_word = qr/=\?($re_token)\?($re_token)\?($re_encoded_text)\?=/;
+
 # Variables we fill in automatically, or via prompting:
 my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
 	$initial_reply_to,$initial_subject,@files,
@@ -913,15 +918,20 @@ $time = time - scalar $#files;
 
 sub unquote_rfc2047 {
 	local ($_) = @_;
-	my $encoding;
-	s{=\?([^?]+)\?q\?(.*?)\?=}{
-		$encoding = $1;
-		my $e = $2;
-		$e =~ s/_/ /g;
-		$e =~ s/=([0-9A-F]{2})/chr(hex($1))/eg;
-		$e;
+	my $charset;
+	s{$re_encoded_word}{
+		$charset = $1;
+		my $encoding = $2;
+		my $text = $3;
+		if ($encoding eq 'q' || $encoding eq 'Q') {
+			$text =~ s/_/ /g;
+			$text =~ s/=([0-9A-F]{2})/chr(hex($1))/egi;
+			$text;
+		} else {
+			$&; # other encodings not supported yet
+		}
 	}eg;
-	return wantarray ? ($_, $encoding) : $_;
+	return wantarray ? ($_, $charset) : $_;
 }
 
 sub quote_rfc2047 {
@@ -934,10 +944,8 @@ sub quote_rfc2047 {
 
 sub is_rfc2047_quoted {
 	my $s = shift;
-	my $token = qr/[^][()<>@,;:"\/?.= \000-\037\177-\377]+/;
-	my $encoded_text = qr/[!->@-~]+/;
 	length($s) <= 75 &&
-	$s =~ m/^(?:"[[:ascii:]]*"|=\?$token\?$token\?$encoded_text\?=)$/o;
+	$s =~ m/^(?:"[[:ascii:]]*"|$re_encoded_word)$/o;
 }
 
 sub subject_needs_rfc2047_quoting {
-- 
2.1.1

^ permalink raw reply related	[relevance 56%]

* [PATCH RFC3.5.1 03/12] send-email: Interpret --smtp-server "" as "use a default".
  @ 2009-04-19 14:16 56% ` Michael Witten
  0 siblings, 0 replies; 200+ results
From: Michael Witten @ 2009-04-19 14:16 UTC (permalink / raw)
  To: git

Why not? It's at least useful for testing.

Signed-off-by: Michael Witten <mfwitten@gmail.com>
---

		NOTE: This also resulted in a similar change to:
		[PATCH RFC3.5 04/12] send-email: Verification...

 Documentation/git-send-email.txt |    4 +++-
 git-send-email.perl              |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 071e9bf..0937dd0 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -132,7 +132,9 @@ user is prompted for a password while the input is masked for privacy.
 	be specified by the 'sendemail.smtpserver' configuration
 	variable; the built-in default is `/usr/sbin/sendmail` or
 	`/usr/lib/sendmail` if such a program is available, or
-	`localhost` otherwise.
+	`localhost` otherwise. Also, the built-in default is used if
+	`<host>` or 'sendemail.smtpserver' is the empty string (for
+	example, if '--smtp-server ""' is specified on the command line).
 
 --smtp-server-port=<port>::
 	Specifies a port different from the default port (SMTP
diff --git a/git-send-email.perl b/git-send-email.perl
index fed3554..be6d171 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -675,7 +675,7 @@ if (defined $initial_reply_to) {
 	$initial_reply_to = "<$initial_reply_to>" if $initial_reply_to ne '';
 }
 
-if (defined $smtp_server) {
+if (defined $smtp_server && $smtp_server ne '') {
 
 	$smtp_server_is_a_command = ($smtp_server =~ m{^/});
 
-- 
1.6.2.2.479.g2aec

^ permalink raw reply related	[relevance 56%]

* Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present
  @ 2007-08-09 12:28 57% ` Uwe Kleine-König
  0 siblings, 0 replies; 200+ results
From: Uwe Kleine-König @ 2007-08-09 12:28 UTC (permalink / raw)
  To: Greg KH; +Cc: Junio C Hamano, git

Hello,

Greg KH wrote:
> When using git-send-email.perl on a changeset that has:
> 	Cc: <stable@kernel.org>
> in the body of the description, and the Email::Valid perl module is
> installed on the system, the email address will be deemed "invalid" for
> some reason (Email::Valid isn't smart enough to handle this?) and
> complain and not send the address the email.
The reason is probably that it is indeed invalid.  From rfc822:

mailbox		= addr-spec / phrase route-addr
addr-spec	= local-part "@" domain
phrase		= 1*word
word		= atom / quoted-string
atom		= 1*<any CHAR except specials, SPACE and CTLs>
quoted-string	= <"> *(qtext/quoted-pair) <">
route-addr	= "<" [route] addr-spec ">"
...

where 1* means "at least one of".

That is, either you must not use <...> or you need a non-empty phrase.

Actually this grammar looks wrong, because as I read it it would not
allow spaces between words in phrase.  But that's another issue.

BTW: Outlook depends on this, because if you use Cc:
<stable@kernel.org>, it doesn't show anything in the Cc: line---at least
in the default configuration.

So I suggest the following:

---- >8 ----
send-email: rfc822 forbids using <address@domain> without a non-empty "phrase"

Email::Valid does respect this considering such a mailbox specification
invalid.  b06c6bc831cbb9e9eb82fd3ffd5a2b674cd940d0 addressed the issue, but
only if Email::Valid is available.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
---
 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 39e433b..a02ab96 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -408,8 +408,8 @@ sub extract_valid_address {
 	# check for a local address:
 	return $address if ($address =~ /^($local_part_regexp)$/);
 
+	$address =~ s/^\s*<(.*)>\s*$/$1/;
 	if ($have_email_valid) {
-		$address =~ s/^\s*<(.*)>\s*$/$1/;
 		return scalar Email::Valid->address($address);
 	} else {
 		# less robust/correct than the monster regexp in Email::Valid,
-- 
1.5.3.rc3.943.g14c81

-- 
Uwe Kleine-König

If a lawyer and an IRS agent were both drowning, and you could only save
one of them, would you go to lunch or read the paper?

^ permalink raw reply related	[relevance 57%]

* [PATCH] send-email: do not check for editor until needed
    2010-03-22 16:12 61% ` [PATCH] send-email: lazily assign editor variable Michael J Gruber
@ 2010-03-22 23:25 57% ` Jonathan Nieder
  1 sibling, 0 replies; 200+ results
From: Jonathan Nieder @ 2010-03-22 23:25 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: git, Junio C Hamano, Marc Kleine-Budde, Jay Soffian

Since b4479f074 (add -i, send-email, svn, p4, etc: use "git var
GIT_EDITOR", 2009-10-30), when called with TERM=dumb and without
GIT_EDITOR set, git send-email has been failing whether it needs
an editor or not:

 $ ssh localhost git send-email --to=me --suppress-cc=all HEAD^..HEAD
 fatal: Terminal is dumb, but EDITOR unset
 var GIT_EDITOR: command returned error: 128

This breaks use of git send-email in existing hook scripts.

So do not check for an editor unless it is needed.

Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Uwe Kleine-König wrote:

> since b4479f074760a788dd4e353b8c86a7d735afc53e git send-email (and
> others) use git var GIT_EDITOR.  This is OK as such but it breaks the
> post-receive hooks that I use on several repositories.
[...]
> IMHO git send-email should only call $(git var GIT_EDITOR) when it
> actually needs it.

Thanks for reporting.  Does this patch work for you?

Now if I try without a tty, I get a different error:

 $ ssh localhost cd $(pwd) '&&' \
	git send-email --to=me --suppress-cc=all HEAD^..HEAD
 Can't locate object method "IN" via package "FakeTerm" at
 /home/jrn/tmp-git/libexec/git-core/git-send-email line 645.
 /tmp/olTiwjzrjx/0001-Git-1.7.0.3.patch

I assume I am not using it correctly, since the relevant code has
been around for a while.

 git-send-email.perl |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index e05455f..9406cdd 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -162,9 +162,16 @@ my $compose_filename;
 
 # Handle interactive edition of files.
 my $multiedit;
-my $editor = Git::command_oneline('var', 'GIT_EDITOR');
 
 sub do_edit {
+	my $editor;
+
+	if ($#_ == 0) {
+		return;
+	}
+	git_cmd_try {
+		$editor = Git::command_oneline('var', 'GIT_EDITOR');
+	} "no suitable text editor configured\n";
 	if (defined($multiedit) && !$multiedit) {
 		map {
 			system('sh', '-c', $editor.' "$@"', $editor, $_);
-- 
1.7.0.2

^ permalink raw reply related	[relevance 57%]

* [PATCH 02/16] send-email: use lexical filehandles for $compose
                     ` (14 preceding siblings ...)
  2010-09-30 13:42 58% ` [PATCH 03/16] send-email: use lexical filehandles during sending Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:42 57% ` Ævar Arnfjörð Bjarmason
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:42 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-send-email.perl |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 2f18d83..634835c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -567,7 +567,7 @@ if ($compose) {
 	$compose_filename = ($repo ?
 		tempfile(".gitsendemail.msg.XXXXXX", DIR => $repo->repo_path()) :
 		tempfile(".gitsendemail.msg.XXXXXX", DIR => "."))[1];
-	open(C,">",$compose_filename)
+	open my $c, ">", $compose_filename
 		or die "Failed to open for writing $compose_filename: $!";
 
 
@@ -575,7 +575,7 @@ if ($compose) {
 	my $tpl_subject = $initial_subject || '';
 	my $tpl_reply_to = $initial_reply_to || '';
 
-	print C <<EOT;
+	print $c <<EOT;
 From $tpl_sender # This line is ignored.
 GIT: Lines beginning in "GIT:" will be removed.
 GIT: Consider including an overall diffstat or table of contents
@@ -588,9 +588,9 @@ In-Reply-To: $tpl_reply_to
 
 EOT
 	for my $f (@files) {
-		print C get_patch_subject($f);
+		print $c get_patch_subject($f);
 	}
-	close(C);
+	close $c;
 
 	if ($annotate) {
 		do_edit($compose_filename, @files);
@@ -598,23 +598,23 @@ EOT
 		do_edit($compose_filename);
 	}
 
-	open(C2,">",$compose_filename . ".final")
+	open my $c2, ">", $compose_filename . ".final"
 		or die "Failed to open $compose_filename.final : " . $!;
 
-	open(C,"<",$compose_filename)
+	open $c, "<", $compose_filename
 		or die "Failed to open $compose_filename : " . $!;
 
 	my $need_8bit_cte = file_has_nonascii($compose_filename);
 	my $in_body = 0;
 	my $summary_empty = 1;
-	while(<C>) {
+	while(<$c>) {
 		next if m/^GIT:/;
 		if ($in_body) {
 			$summary_empty = 0 unless (/^\n$/);
 		} elsif (/^\n$/) {
 			$in_body = 1;
 			if ($need_8bit_cte) {
-				print C2 "MIME-Version: 1.0\n",
+				print $c2 "MIME-Version: 1.0\n",
 					 "Content-Type: text/plain; ",
 					   "charset=UTF-8\n",
 					 "Content-Transfer-Encoding: 8bit\n";
@@ -639,10 +639,10 @@ EOT
 			print "To/Cc/Bcc fields are not interpreted yet, they have been ignored\n";
 			next;
 		}
-		print C2 $_;
+		print $c2 $_;
 	}
-	close(C);
-	close(C2);
+	close $c;
+	close $c2;
 
 	if ($summary_empty) {
 		print "Summary email is empty, skipping it\n";
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 57%]

* [PATCH v2 1/2] send-email: align RFC 2047 decoding more closely with the spec
@ 2014-12-14 15:59 57% Роман Донченко
  2014-12-14 15:59 64% ` [PATCH v2 2/2] send-email: handle adjacent RFC 2047-encoded words properly Роман Донченко
  0 siblings, 1 reply; 200+ results
From: Роман Донченко @ 2014-12-14 15:59 UTC (permalink / raw)
  To: gitster; +Cc: git

More specifically:

* Add "\" to the list of characters not allowed in a token (see RFC 2047
  errata).

* Share regexes between unquote_rfc2047 and is_rfc2047_quoted. Besides
  removing duplication, this also makes unquote_rfc2047 more stringent.

* Allow both "q" and "Q" to identify the encoding.

* Allow lowercase hexadecimal digits in the "Q" encoding.

And, more on the cosmetic side:

* Change the "encoded-text" regex to exclude rather than include characters,
  for clarity and consistency with "token".

Signed-off-by: Роман Донченко <dpb@corrigendum.ru>
Acked-by: Jeff King <peff@peff.net>
---
 git-send-email.perl | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 9949db0..d461ffb 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -145,6 +145,11 @@ my $have_mail_address = eval { require Mail::Address; 1 };
 my $smtp;
 my $auth;
 
+# Regexes for RFC 2047 productions.
+my $re_token = qr/[^][()<>@,;:\\"\/?.= \000-\037\177-\377]+/;
+my $re_encoded_text = qr/[^? \000-\037\177-\377]+/;
+my $re_encoded_word = qr/=\?($re_token)\?($re_token)\?($re_encoded_text)\?=/;
+
 # Variables we fill in automatically, or via prompting:
 my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
 	$initial_reply_to,$initial_subject,@files,
@@ -913,15 +918,20 @@ $time = time - scalar $#files;
 
 sub unquote_rfc2047 {
 	local ($_) = @_;
-	my $encoding;
-	s{=\?([^?]+)\?q\?(.*?)\?=}{
-		$encoding = $1;
-		my $e = $2;
-		$e =~ s/_/ /g;
-		$e =~ s/=([0-9A-F]{2})/chr(hex($1))/eg;
-		$e;
+	my $charset;
+	s{$re_encoded_word}{
+		$charset = $1;
+		my $encoding = $2;
+		my $text = $3;
+		if ($encoding eq 'q' || $encoding eq 'Q') {
+			$text =~ s/_/ /g;
+			$text =~ s/=([0-9A-F]{2})/chr(hex($1))/egi;
+			$text;
+		} else {
+			$&; # other encodings not supported yet
+		}
 	}eg;
-	return wantarray ? ($_, $encoding) : $_;
+	return wantarray ? ($_, $charset) : $_;
 }
 
 sub quote_rfc2047 {
@@ -934,10 +944,8 @@ sub quote_rfc2047 {
 
 sub is_rfc2047_quoted {
 	my $s = shift;
-	my $token = qr/[^][()<>@,;:"\/?.= \000-\037\177-\377]+/;
-	my $encoded_text = qr/[!->@-~]+/;
 	length($s) <= 75 &&
-	$s =~ m/^(?:"[[:ascii:]]*"|=\?$token\?$token\?$encoded_text\?=)$/o;
+	$s =~ m/^(?:"[[:ascii:]]*"|$re_encoded_word)$/o;
 }
 
 sub subject_needs_rfc2047_quoting {
-- 
2.1.1

^ permalink raw reply related	[relevance 57%]

* [PATCH RFC3.5 03/12] send-email: Interpret --smtp-server "" as "use a default".
  @ 2009-04-18 17:01 57%     ` Michael Witten
  0 siblings, 0 replies; 200+ results
From: Michael Witten @ 2009-04-18 17:01 UTC (permalink / raw)
  To: git

Why not? It's at least useful for testing.

Signed-off-by: Michael Witten <mfwitten@gmail.com>
---
 Documentation/git-send-email.txt |    4 +++-
 git-send-email.perl              |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 071e9bf..ae01632 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -132,7 +132,9 @@ user is prompted for a password while the input is masked for privacy.
 	be specified by the 'sendemail.smtpserver' configuration
 	variable; the built-in default is `/usr/sbin/sendmail` or
 	`/usr/lib/sendmail` if such a program is available, or
-	`localhost` otherwise.
+	`localhost` otherwise. Also, a built-in default is used if
+	`<host>` or 'sendemail.smtpserver' is the empty string (for
+	example, if '--smtp-server ""' is specified on the command line).
 
 --smtp-server-port=<port>::
 	Specifies a port different from the default port (SMTP
diff --git a/git-send-email.perl b/git-send-email.perl
index 1a20b2c..5e669c7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -675,7 +675,7 @@ if (defined $initial_reply_to) {
 	$initial_reply_to = "<$initial_reply_to>" if $initial_reply_to ne '';
 }
 
-if (defined $smtp_server) {
+if (defined $smtp_server && $smtp_server ne '') {
 
 	$smtp_server_is_a_command = ($smtp_server =~ m{^/});
 
-- 
1.6.2.2.479.g2aec

^ permalink raw reply related	[relevance 57%]

* [PATCH] send-email: auth plain/login fix
  @ 2011-09-29 17:02 57% ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 0 replies; 200+ results
From: Zbigniew Jędrzejewski-Szmek @ 2011-09-29 17:02 UTC (permalink / raw)
  To: gitster, joe, git, peff; +Cc: Zbigniew Jędrzejewski-Szmek

git send-email was not authenticating properly when communicating over
TLS with a server supporting only AUTH PLAIN and AUTH LOGIN. This is
e.g. the standard server setup under debian with exim4 and probably
everywhere where system accounts are used.

The problem (only?) exists when libauthen-sasl-cyrus-perl
(Authen::SASL::Cyrus) is installed. Importing Authen::SASL::Perl
makes Authen::SASL use the perl implementation which works
better.

The solution is based on this forum thread:
http://www.perlmonks.org/?node_id=904354.

This patch is tested by sending it. Without this fix, the interaction with
the server failed like this:

$ git send-email --smtp-encryption=tls --smtp-server=... --smtp-debug=1 change1.patch
...
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-AUTH LOGIN PLAIN
Password:
Net::SMTP::SSL=GLOB(0x238f668)>>> AUTH
Net::SMTP::SSL=GLOB(0x238f668)<<< 501 5.5.2 AUTH mechanism must be specified
5.5.2 AUTH mechanism must be specified

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
v2:  - the import is performed only if it will be used
v3:  - the import is performed only if it will be used, and failure is ignored
v4:  - improved commit message
v5:  - comment in code

 git-send-email.perl |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 98ab33a..f2a6e46 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1095,6 +1095,12 @@ X-Mailer: git-send-email $gitversion
 		}
 
 		if (defined $smtp_authuser) {
+			# Workaround AUTH PLAIN/LOGIN interaction defect
+			# with Authen::SASL::Cyrus
+			eval {
+				require Authen::SASL;
+				Authen::SASL->import(qw(Perl));
+			};
 
 			if (!defined $smtp_authpass) {
 
-- 
1.7.6

^ permalink raw reply related	[relevance 57%]

* Regression: git send-email Message-Id: numbering doesn't start at 1 any more
@ 2023-11-06 15:32 57% Uwe Kleine-König
  0 siblings, 0 replies; 200+ results
From: Uwe Kleine-König @ 2023-11-06 15:32 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Douglas Anderson, entwicklung

[-- Attachment #1: Type: text/plain, Size: 2079 bytes --]

Hello,

Since commit 3ece9bf0f9e24909b090cf348d89e8920bd4f82f I experience that
the generated Message-Ids don't start at ....-1-... any more. I have:

$ git send-email w/*
...
Subject: [PATCH 0/5] watchdog: Drop platform_driver_probe() and convert to platform remove callback returning void (part II)
Date: Mon,  6 Nov 2023 16:10:04 +0100
Message-ID: <20231106151003.3844134-7-u.kleine-koenig@pengutronix.de>
...

So the cover letter is sent with Message-Id: ...-7-...

Before above mentioned commit I had:

...
Message-ID: <20231106151003.3844134-1-u.kleine-koenig@pengutronix.de>
...

Similar to my earlier regression report this also only happens in the
presence of a sendemail-validate hook. Passing --no-validate works
around this issue.

While this isn't an issue for git itself, it breaks one of my scripts
that knows how to determine the number of patches in a series from the
last Message-Id:.

The following patch works for me:

diff --git a/git-send-email.perl b/git-send-email.perl
index 9e21b0b3f43a..095a3d9dd720 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -799,6 +799,7 @@ sub is_format_patch_arg {
 
 $time = time - scalar $#files;
 
+my ($message_id_stamp, $message_id_serial);
 if ($validate) {
 	# FIFOs can only be read once, exclude them from validation.
 	my @real_files = ();
@@ -821,6 +822,7 @@ sub is_format_patch_arg {
 	}
 	delete $ENV{GIT_SENDEMAIL_FILE_COUNTER};
 	delete $ENV{GIT_SENDEMAIL_FILE_TOTAL};
+	$message_id_serial = 0;
 }
 
 @files = handle_backup_files(@files);
@@ -1181,7 +1183,6 @@ sub validate_address_list {
 
 # We'll setup a template for the message id, using the "from" address:
 
-my ($message_id_stamp, $message_id_serial);
 sub make_message_id {
 	my $uniq;
 	if (!defined $message_id_stamp) {

But I guess this could be done prettier by someone who is fluent in
Perl.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[relevance 57%]

* Re: [PATCH] send-email: remove documented requirement for Net::SMTP::SSL
  @ 2019-05-28  0:05 57%   ` Todd Zullinger
  0 siblings, 0 replies; 200+ results
From: Todd Zullinger @ 2019-05-28  0:05 UTC (permalink / raw)
  To: Eric Wong; +Cc: Chris Mayo, Jonathan Nieder, Dennis Kaarsemaker, git

Eric Wong wrote:
> Chris Mayo <aklhfex@gmail.com> wrote:
>> git-send-email uses the TLS support in the Net::SMTP core module from
>> recent versions of Perl. Documenting the minimum version is complex
>> because of separate numbering for Perl (5.21.5~169), Net:SMTP (2.34)
>> and libnet (3.01). Version numbers from commit:
>> bfbfc9a953 ("send-email: Net::SMTP::starttls was introduced in v2.34",
>> 2017-05-31)
> 
> No disagreement for removing the doc requirement for Net::SMTP::SSL.
> 
> But core modules can be split out by OS packagers.  For
> Fedora/RH-based systems, the trend tends to be increasing
> granularity and having more optional packages.
> 
> So I think documenting Net::SMTP (and Net::Domain) as
> requirements would still be good, perhaps with a note stating
> they're typically installed with Perl.

I didn't know that git-send-email.perl could take advantage
of Net::SMTP::starttls until I read this.

[Adding Dennis and Jonathan as the authors of 0ead000c3a
("send-email: Net::SMTP::SSL is obsolete, use only when
necessary", 2017-03-24) bfbfc9a953 ("send-email:
Net::SMTP::starttls was introduced in v2.34", 2017-05-31),
respectively.]

The current Fedora and Red Hat package have a requirement on
Net::SMTP::SSL from long, long ago¹.  As I looked at whether
I could remove that (or more accurately, replace it with
IO::Socket::SSL which is needed for Net::SMTP to handle
starttls), I noticed that on RHEL7 the Net::SMTP version was
2.31, but starttls support has been backported².

I wonder if it's (separately from this change) worth
adjusting the conditional which sets $use_net_smtp_ssl to
use "Net::SMTP->can('starttls')" rather than a strict
version check?  (It might not be if using 'can' is too
fragile or would only benefit the Red Hat 7 packages which
likely won't officially be updated to a newer git with such
a change.)

Something like:

diff --git i/git-send-email.perl w/git-send-email.perl
index 24859a7bc3..84ac03994d 100755
--- i/git-send-email.perl
+++ w/git-send-email.perl
@@ -1465,7 +1465,7 @@ sub send_message {
 		}
 
 		require Net::SMTP;
-		my $use_net_smtp_ssl = version->parse($Net::SMTP::VERSION) < version->parse("2.34");
+		my $use_net_smtp_ssl = Net::SMTP->can('starttls') ? 0 : 1;
 		$smtp_domain ||= maildomain();
 
 		if ($smtp_encryption eq 'ssl') {

¹ https://bugzilla.redhat.com/443615
² https://bugzilla.redhat.com/1557574
  https://git.centos.org/rpms/perl/c/13dfe3?branch=c7

-- 
Todd

^ permalink raw reply related	[relevance 57%]

* [PATCH v2] send-email: ask about and declare 8bit mails
  @ 2010-06-17 20:10 57% ` Thomas Rast
  0 siblings, 0 replies; 200+ results
From: Thomas Rast @ 2010-06-17 20:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

git-send-email passes on an 8bit mail as-is even if it does not
declare a content-type.  Because the user can edit email between
format-patch and send-email, such invalid mails are unfortunately not
very hard to come by.

Make git-send-email stop and ask about the encoding to use if it
encounters any such mail.  Also provide a configuration setting to
permanently configure an encoding.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

Junio C Hamano wrote:
> > * tr/send-email-8bit (2010-06-12) 1 commit
> 
> If I am not misreading the patch, it does not seem to stop the scanning of
> the "C-T-E:" header at the end of header; it should.

You're right.  I fixed that in this version.


[I'm leaving for holidays tomorrow, so if there are more problems with
this patch (who knows) you'll have to hold it in pu for a while.]


 Documentation/git-send-email.txt |    9 ++++
 git-send-email.perl              |   60 +++++++++++++++++++++++++++++
 t/t9001-send-email.sh            |   77 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3dfdc7c..e70d9bf 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -101,6 +101,15 @@ See the CONFIGURATION section for 'sendemail.multiedit'.
 +
 The --to option must be repeated for each user you want on the to list.
 
+--8bit-encoding=<encoding>::
+	When encountering a non-ASCII message or subject that does not
+	declare its encoding, add headers/quoting to indicate it is
+	encoded in <encoding>.  Default is the value of the
+	'sendemail.assume8bitEncoding'; if that is unspecified, this
+	will be prompted for if any non-ASCII files are encountered.
++
+Note that no attempts whatsoever are made to validate the encoding.
+
 
 Sending
 ~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index ce569a9..0db39b0 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -54,6 +54,7 @@ git send-email [options] <file | directory | rev-list options >
     --in-reply-to           <str>  * Email "In-Reply-To:"
     --annotate                     * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
+    --8bit-encoding         <str>  * Encoding to assume 8bit mails if undeclared
 
   Sending:
     --envelope-sender       <str>  * Email envelope sender.
@@ -193,6 +194,7 @@ my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
 my ($validate, $confirm);
 my (@suppress_cc);
+my ($auto_8bit_encoding);
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -223,6 +225,7 @@ my %config_settings = (
     "multiedit" => \$multiedit,
     "confirm"   => \$confirm,
     "from" => \$sender,
+    "assume8bitencoding" => \$auto_8bit_encoding,
 );
 
 # Help users prepare for 1.7.0
@@ -298,6 +301,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "thread!" => \$thread,
 		    "validate!" => \$validate,
 		    "format-patch!" => \$format_patch,
+		    "8bit-encoding=s" => \$auto_8bit_encoding,
 	 );
 
 unless ($rc) {
@@ -670,6 +674,35 @@ sub ask {
 	return undef;
 }
 
+my %broken_encoding;
+
+sub file_declares_8bit_cte($) {
+	my $fn = shift;
+	open (my $fh, '<', $fn);
+	while (my $line = <$fh>) {
+		last if ($line =~ /^$/);
+		return 1 if ($line =~ /^Content-Transfer-Encoding: .*8bit.*$/);
+	}
+	close $fh;
+	return 0;
+}
+
+foreach my $f (@files) {
+	next unless (body_or_subject_has_nonascii($f)
+		     && !file_declares_8bit_cte($f));
+	$broken_encoding{$f} = 1;
+}
+
+if (!defined $auto_8bit_encoding && scalar %broken_encoding) {
+	print "The following files are 8bit, but do not declare " .
+		"a Content-Transfer-Encoding.\n";
+	foreach my $f (sort keys %broken_encoding) {
+		print "    $f\n";
+	}
+	$auto_8bit_encoding = ask("Which 8bit encoding should I declare [UTF-8]? ",
+				  default => "UTF-8");
+}
+
 my $prompting = 0;
 if (!defined $sender) {
 	$sender = $repoauthor || $repocommitter || '';
@@ -1225,6 +1258,18 @@ foreach my $t (@files) {
 			or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
 	}
 
+	if ($broken_encoding{$t} && !$has_content_type) {
+		$has_content_type = 1;
+		push @xh, "MIME-Version: 1.0",
+			"Content-Type: text/plain; charset=$auto_8bit_encoding",
+			"Content-Transfer-Encoding: 8bit";
+		$body_encoding = $auto_8bit_encoding;
+	}
+
+	if ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {
+		$subject = quote_rfc2047($subject, $auto_8bit_encoding);
+	}
+
 	if (defined $author and $author ne $sender) {
 		$message = "From: $author\n\n$message";
 		if (defined $author_encoding) {
@@ -1237,6 +1282,7 @@ foreach my $t (@files) {
 				}
 			}
 			else {
+				$has_content_type = 1;
 				push @xh,
 				  'MIME-Version: 1.0',
 				  "Content-Type: text/plain; charset=$author_encoding",
@@ -1314,3 +1360,17 @@ sub file_has_nonascii {
 	}
 	return 0;
 }
+
+sub body_or_subject_has_nonascii {
+	my $fn = shift;
+	open(my $fh, '<', $fn)
+		or die "unable to open $fn: $!\n";
+	while (my $line = <$fh>) {
+		last if $line =~ /^$/;
+		return 1 if $line =~ /^Subject.*[^[:ascii:]]/;
+	}
+	while (my $line = <$fh>) {
+		return 1 if $line =~ /[^[:ascii:]]/;
+	}
+	return 0;
+}
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 640b3d2..0b8a591 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -918,4 +918,81 @@ test_expect_success '--no-bcc overrides sendemail.bcc' '
 	! grep "RCPT TO:<other@ex.com>" stdout
 '
 
+cat >email-using-8bit <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: author@example.com
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+Subject: subject goes here
+
+Dieser deutsche Text enthält einen Umlaut!
+EOF
+
+cat >content-type-decl <<EOF
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+EOF
+
+test_expect_success 'asks about and fixes 8bit encodings' '
+	clean_fake_sendmail &&
+	echo |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			email-using-8bit >stdout &&
+	grep "do not declare a Content-Transfer-Encoding" stdout &&
+	grep email-using-8bit stdout &&
+	grep "Which 8bit encoding" stdout &&
+	grep "Content\\|MIME" msgtxt1 >actual &&
+	test_cmp actual content-type-decl
+'
+
+test_expect_success 'sendemail.8bitEncoding works' '
+	clean_fake_sendmail &&
+	git config sendemail.assume8bitEncoding UTF-8 &&
+	echo bogus |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			email-using-8bit >stdout &&
+	grep "Content\\|MIME" msgtxt1 >actual &&
+	test_cmp actual content-type-decl
+'
+
+test_expect_success '--8bit-encoding overrides sendemail.8bitEncoding' '
+	clean_fake_sendmail &&
+	git config sendemail.assume8bitEncoding "bogus too" &&
+	echo bogus |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--8bit-encoding=UTF-8 \
+			email-using-8bit >stdout &&
+	grep "Content\\|MIME" msgtxt1 >actual &&
+	test_cmp actual content-type-decl
+'
+
+cat >email-using-8bit <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: author@example.com
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+Subject: Dieser Betreff enthält auch einen Umlaut!
+
+Nothing to see here.
+EOF
+
+cat >expected <<EOF
+Subject: =?UTF-8?q?Dieser=20Betreff=20enth=C3=A4lt=20auch=20einen=20Umlaut!?=
+EOF
+
+test_expect_success '--8bit-encoding also treats subject' '
+	clean_fake_sendmail &&
+	echo bogus |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--8bit-encoding=UTF-8 \
+			email-using-8bit >stdout &&
+	grep "Subject" msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
 test_done
-- 
1.7.1.635.g9a994

^ permalink raw reply related	[relevance 57%]

* [PATCH v4] send-email: auth plain/login fix
  @ 2011-09-29 14:16 58% ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 0 replies; 200+ results
From: Zbigniew Jędrzejewski-Szmek @ 2011-09-29 14:16 UTC (permalink / raw)
  To: gitster, joe, git, peff

git send-email was not authenticating properly when communicating over
TLS with a server supporting only AUTH PLAIN and AUTH LOGIN. This is
e.g. the standard server setup under debian with exim4 and probably
everywhere where system accounts are used.

The problem (only?) exists when libauthen-sasl-cyrus-perl
(Authen::SASL::Cyrus) is installed. Importing Authen::SASL::Perl
makes Authen::SASL use the perl implementation which works
better.

The solution is based on this forum thread:
http://www.perlmonks.org/?node_id=904354.

This patch is tested by sending it. Without this fix, the interaction with
the server failed like this:

$ git send-email --smtp-encryption=tls --smtp-server=... --smtp-debug=1 change1.patch
...
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-AUTH LOGIN PLAIN
Password:
Net::SMTP::SSL=GLOB(0x238f668)>>> AUTH
Net::SMTP::SSL=GLOB(0x238f668)<<< 501 5.5.2 AUTH mechanism must be specified
5.5.2 AUTH mechanism must be specified

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

---
v2:  - the import is performed only if it will be used
v3:  - the import is performed only if it will be used, and failure is ignored
v4:  - improved commit message

 git-send-email.perl |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 37dfbe7..dbc435a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1098,6 +1098,10 @@ X-Mailer: git-send-email $gitversion
 		}
 
 		if (defined $smtp_authuser) {
+			eval {
+				require Authen::SASL;
+				Authen::SASL->import(qw(Perl));
+			};
 
 			if (!defined $smtp_authpass) {
 
-- 
1.7.6

^ permalink raw reply related	[relevance 58%]

* [PATCH] git-send-email: add a new sendemail.to configuration variable
@ 2007-10-01 12:42 58% Miklos Vajna
  0 siblings, 0 replies; 200+ results
From: Miklos Vajna @ 2007-10-01 12:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Miklos Vajna, git

Several projects prefers to receive patches via a given email address. In these
cases it's handy to configure that address once.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 Documentation/git-send-email.txt |    3 +++
 git-send-email.perl              |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3727776..e38b702 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -159,6 +159,9 @@ sendemail.aliasfiletype::
 	Format of the file(s) specified in sendemail.aliasesfile. Must be
 	one of 'mutt', 'mailrc', 'pine', or 'gnus'.
 
+sendemail.to::
+	Email address (or alias) to always send to.
+
 sendemail.cccmd::
 	Command to execute to generate per patch file specific "Cc:"s.
 
diff --git a/git-send-email.perl b/git-send-email.perl
index 62e1429..96051bc 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -191,6 +191,7 @@ my %config_settings = (
     "smtpserverport" => \$smtp_server_port,
     "smtpuser" => \$smtp_authuser,
     "smtppass" => \$smtp_authpass,
+    "to" => \@to,
     "cccmd" => \$cc_cmd,
     "aliasfiletype" => \$aliasfiletype,
     "bcc" => \@bcclist,
-- 
1.5.3.2.111.g5166-dirty

^ permalink raw reply related	[relevance 58%]

* [PATCH 03/16] send-email: use lexical filehandles during sending
                     ` (13 preceding siblings ...)
  2010-09-30 13:43 60% ` [PATCH 13/16] send-email: extract_valid_address use qr// regexes and /o Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:42 58% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:42 57% ` [PATCH 02/16] send-email: use lexical filehandles for $compose Ævar Arnfjörð Bjarmason
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:42 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-send-email.perl |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 634835c..488d894 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1144,7 +1144,7 @@ $subject = $initial_subject;
 $message_num = 0;
 
 foreach my $t (@files) {
-	open(F,"<",$t) or die "can't open file $t";
+	open my $fh, "<", $t or die "can't open file $t";
 
 	my $author = undef;
 	my $author_encoding;
@@ -1157,7 +1157,7 @@ foreach my $t (@files) {
 	$message = "";
 	$message_num++;
 	# First unfold multiline header fields
-	while(<F>) {
+	while(<$fh>) {
 		last if /^\s*$/;
 		if (/^\s+\S/ and @header) {
 			chomp($header[$#header]);
@@ -1233,7 +1233,7 @@ foreach my $t (@files) {
 		}
 	}
 	# Now parse the message body
-	while(<F>) {
+	while(<$fh>) {
 		$message .=  $_;
 		if (/^(Signed-off-by|Cc): (.*)$/i) {
 			chomp;
@@ -1250,12 +1250,12 @@ foreach my $t (@files) {
 				$c, $_) unless $quiet;
 		}
 	}
-	close F;
+	close $fh;
 
 	if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
-		open(F, "$cc_cmd \Q$t\E |")
+		open my $fh, "$cc_cmd \Q$t\E |"
 			or die "(cc-cmd) Could not execute '$cc_cmd'";
-		while(<F>) {
+		while(<$fh>) {
 			my $c = $_;
 			$c =~ s/^\s*//g;
 			$c =~ s/\n$//g;
@@ -1264,7 +1264,7 @@ foreach my $t (@files) {
 			printf("(cc-cmd) Adding cc: %s from: '%s'\n",
 				$c, $cc_cmd) unless $quiet;
 		}
-		close F
+		close $fh
 			or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
 	}
 
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 58%]

* [PATCH/RFC] git-send-email: Do not encode Subject if not required (was: git-send-email and non 7bit clean message)
  @ 2011-05-04 13:50 58%     ` Jakub Narebski
  0 siblings, 0 replies; 200+ results
From: Jakub Narebski @ 2011-05-04 13:50 UTC (permalink / raw)
  To: Øyvind A. Holm
  Cc: Junio C Hamano, git, Greg Kroah-Hartman, Ryan Anderson

On Tue, 3 May 2011, Jakub Narebski wrote:
> On Sat, 30 Apr 2011, Øyvind A. Holm wrote:
> > On 29 April 2011 23:31, Junio C Hamano <gitster@pobox.com> wrote:

> > > A tangent. It is curious why [PATCH 2/6] alone ended up with an encoded
> > > "Subject" header, like this:
> > >
> > >  Subject: =?UTF-8?q?=5BPATCH=202/6=5D=20gitweb=3A=20Change=20the=20
> > >   way=20=22content=20tags=22=20=28=27ctags=27=29=20are=20handled?=
> > >
> > > The message actually has the above as a long single line, as can be seen at
> > > http://article.gmane.org/gmane.comp.version-control.git/172479/raw
> > >
> > > Just being curious.
> > 
> > This seems as the same thing that I reported on 2010-04-25 23:35:49Z,
> > <http://thread.gmane.org/gmane.comp.version-control.git/145774>. If there's a
> > character above U+007F in the log message below line #2, the Subject: line is
> > garbled. In this case it is, it's the "ö" in Uwe's name that leads to this
> > error.

Note: this line was added "by hand" when editing patch, so commit message
that git-format-patch seen did not contain any non-ASCII characters.
Otherwise fir-format-patch would add correct MIME headers itself.

> > A test to reproduce this is at <https://gist.github.com/378785>, but it seems
> > as this was fixed between v1.7.4.1-292-ge2a57aa and v1.7.4.1-343-ga91df69 ,
> > probably happened in dc7f96f (Merge branch 'jk/format-patch-multiline-header').
> > The patch at <http://article.gmane.org/gmane.comp.version-control.git/172479/raw>
> > was generated with git-1.7.3, so it would trigger the error in this case.
> 
> I have just upgraded git to 1.7.5, and unfortunately it still has the
> same bug (note that UTF-8 character was introduced while editing patch,
> so git-format-patch doesn't see it):
> 
>   5369:[gitweb/web@git]# git send-email [...] --dry-run mdir.1/*.txt
>   The following files are 8bit, but do not declare a Content-Transfer-Encoding.
>       mdir.1/0001-gitweb-Prepare-for-splitting-gitweb.txt
>   Which 8bit encoding should I declare [UTF-8]? <ENTER>
>   Dry-Sent [PATCHv2 0/2] gitweb: Beginnings of splitting gitweb into modules
>   Dry-Sent =?UTF-8?q?=5BPATCHv2=201/2=20=28RFC=3F=29=5D=20gitweb=3A=20Prepare=20for=20splitting=20gitweb?=
>   Dry-Sent [PATCHv2 2/2 (PoC)] gitweb: Create Gitweb::Util module
> 
> Note that having
> 
>   MIME-Version: 1.0
>   Content-Type: text/plain; charset=utf-8
> 
> is not enough[1].
 
Perhaps something like attached patch could be beginning of fixing
this issue.
 
> Footnotes:
> ^^^^^^^^^^
> [1]: Note that git-send-email does something strange: first, the problem
> is with Content-Transfer-Encoding, and git-send-email asks for 8bit
> encoding, suggesting UTF-8, instead of asking for transfer encoding,
> sugesting e.g. 8bit.

Actually git-send-email assumes 8bit if not stated, but it does not
parse 'Content-Type' header for encoding to be used, perhaps correctly
assuming that if required 'Content-Transfer-Encoding' is missing, then
'Content-Type' is most probably missing as well.

-- >8 ---------- >8 --
Subject: [PATCH] git-send-email: Do not encode Subject if not required

If "Subject:" header of an email does not contain non-ASCII characters,
then we don't need to RFC-2047 encode it, even if file had broken
encoding.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 git-send-email.perl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 98ab33a..1c6b1a8 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1281,7 +1281,9 @@ foreach my $t (@files) {
 		$body_encoding = $auto_8bit_encoding;
 	}
 
-	if ($broken_encoding{$t} && !is_rfc2047_quoted($subject)) {
+	if ($broken_encoding{$t} &&
+	    !is_rfc2047_quoted($subject) &&
+	    $subject =~ /[^[:ascii:]]/) {
 		$subject = quote_rfc2047($subject, $auto_8bit_encoding);
 	}
 
-- 
1.7.5

^ permalink raw reply related	[relevance 58%]

* [PATCH] send-email: extend sanitize_address_rfc822 to do rfc2047 quoting
@ 2007-07-10 17:02 59% Uwe Kleine-König
  2007-07-10 17:02 62% ` [PATCH] [RFC] send-email: honor --suppress-from --signed-off-cc Uwe Kleine-König
  0 siblings, 1 reply; 200+ results
From: Uwe Kleine-König @ 2007-07-10 17:02 UTC (permalink / raw)
  To: git; +Cc: Uwe Kleine-König

Without this patch I'm not able to properly send emails as I have a
non-ascii character in my name.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
---
As I'm not a perl profi, someone wants to check this code.

Actually this series is a test, as it is sended with the patched send-email.

I hope it works :-)

Uwe

 git-send-email.perl |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 89f7c36..8b3d450 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -459,16 +459,30 @@ sub unquote_rfc2047 {
 	return "$_";
 }
 
-# If an address contains a . in the name portion, the name must be quoted.
+# If an address contains a non-ascii char in the name port, quote it according
+# to rfc2047.
+# If an address contains a . in the name portion, the name must be quoted using
+# double quotes.
 sub sanitize_address_rfc822
 {
 	my ($recipient) = @_;
-	my ($recipient_name) = ($recipient =~ /^(.*?)\s+</);
+	my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)(\s+<.*)/);
+
+	if ($recipient_name && $recipient_name =~ /[^-a-zA-Z0-9!*+\/ ]/ && $recipient_name !~ /=\?utf-8\?q?.*\?=/) {
+		$recipient_name =~ s/([^-a-zA-Z0-9!*+ ])/sprintf("=%02X", ord($1))/eg;
+		$recipient_name =~ s/ /_/;
+		$recipient_name =~ s/(.*)/=\?utf-8\?q\?$1\?=/;
+	}
+
 	if ($recipient_name && $recipient_name =~ /\./ && $recipient_name !~ /^".*"$/) {
-		my ($name, $addr) = ($recipient =~ /^(.*?)(\s+<.*)/);
-		$recipient = "\"$name\"$addr";
+		$recipient_name = "\"$recipient_name\"";
+	}
+
+	if ($recipient_name) {
+		return "$recipient_name$recipient_addr";
+	} else {
+		return "$recipient";
 	}
-	return $recipient;
 }
 
 sub send_message
-- 
1.5.3.rc0.823.gdedbf

^ permalink raw reply related	[relevance 59%]

* Re: [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters
  @ 2008-03-26  6:20 59%     ` Jeff King
    0 siblings, 1 reply; 200+ results
From: Jeff King @ 2008-03-26  6:20 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: Junio C Hamano, git

On Wed, Mar 26, 2008 at 07:59:48AM +0200, Teemu Likonen wrote:

> These patches seem to work except that the quoting of Subject field 
> works only if user types a non-Ascii text to the "What subject should 
> the initial email start with?" prompt. If she changes the subject in 
> editor it won't be rfc2047-quoted.

Ah, yes, I hadn't considered that. We should definitely do the quoting
after all of the user's input. Replace 2/2 from my series with the patch
below, which handles this case correctly (and as a bonus, the user sees
the unencoded subject in the editor, which is much more readable).

> Thank you anyway, I think we're going to right direction. I think 'git 
> send-mail --compose' is nice way to produce introductory message to 
> patch series. If --compose doesn't support MIME encoding reasonable 
> way, user may have to write and send intro message with real MUA and 
> find out the Message-Id for correct In-Reply-To field for the actual 
> patch series.

git-format-patch recently got a --cover-letter option which does the
same thing. I actually use a real MUA (mutt) instead of send-email, and
this way you can avoid the message-id cutting and pasting that is
required. It automatically does the right thing with encodings because I
end up sending the message using my MUA.

> E-mail agents KMail and Mutt have setting for preferred encodings for 
> outgoing mail. It's a list of encodings, 
> like "us-ascii,iso-8859-1,utf-8". The first one that fits (including 
> From, To, Cc, Subject, the body, ...?) is used, so there is some kind 
> of detection of content after the message has been composed.

Yes, the git-send-email code is a real mess for this sort of thing. I
think it started very small and specific, and has gotten hack upon hack
piled on it. It would be much nicer rewritten from scratch around one of
the many abstracted perl mail objects (though that does introduce a new
dependency).

> If portable content encoding detection is difficult or considered 
> unnecessary, then I think a documented configurable option is fine 
> (UTF-8 by default).

I think that is sensible. Want to try adding it on top of my patches?

Below is the revised subject-munging patch.

-- >8 --
send-email: rfc2047-quote subject lines with non-ascii characters

We always use 'utf-8' as the encoding, since we currently
have no way of getting the information from the user.

This also refactors the quoting of recipient names, since
both processes can share the rfc2047 quoting code.

Signed-off-by: Jeff King <peff@peff.net>
---
 git-send-email.perl   |   20 ++++++++++++++++++--
 t/t9001-send-email.sh |   15 +++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 7c4f06c..3694f81 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -536,6 +536,15 @@ EOT
 		if (!$in_body && /^MIME-Version:/i) {
 			$need_8bit_cte = 0;
 		}
+		if (!$in_body && /^Subject: ?(.*)/i) {
+			my $subject = $1;
+			$_ = "Subject: " .
+				($subject =~ /[^[:ascii:]]/ ?
+				 quote_rfc2047($subject) :
+				 $subject) .
+				"\n";
+			}
+		}
 		print C2 $_;
 	}
 	close(C);
@@ -626,6 +635,14 @@ sub unquote_rfc2047 {
 	return wantarray ? ($_, $encoding) : $_;
 }
 
+sub quote_rfc2047 {
+	local $_ = shift;
+	my $encoding = shift || 'utf-8';
+	s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
+	s/(.*)/=\?$encoding\?q\?$1\?=/;
+	return $_;
+}
+
 # use the simplest quoting being able to handle the recipient
 sub sanitize_address
 {
@@ -643,8 +660,7 @@ sub sanitize_address
 
 	# rfc2047 is needed if a non-ascii char is included
 	if ($recipient_name =~ /[^[:ascii:]]/) {
-		$recipient_name =~ s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
-		$recipient_name =~ s/(.*)/=\?utf-8\?q\?$1\?=/;
+		$recipient_name = quote_rfc2047($recipient_name);
 	}
 
 	# double quotes are needed if specials or CTLs are included
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e222c49..a4bcd28 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -210,4 +210,19 @@ test_expect_success '--compose respects user mime type' '
 	! grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
 '
 
+test_expect_success '--compose adds MIME for utf8 subject' '
+	clean_fake_sendmail &&
+	echo y | \
+	  GIT_EDITOR=$(pwd)/fake-editor \
+	  GIT_SEND_EMAIL_NOTTY=1 \
+	  git send-email \
+	  --compose --subject utf8-sübjëct \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^fake edit" msgtxt1 &&
+	grep "^Subject: =?utf-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
+'
+
 test_done
-- 
1.5.5.rc1.123.ge5f4e6

^ permalink raw reply related	[relevance 59%]

* [PATCH] Avoid warning when From: is encoded
@ 2008-07-25 13:06 59% Peter Valdemar Mørch
  0 siblings, 0 replies; 200+ results
From: Peter Valdemar Mørch @ 2008-07-25 13:06 UTC (permalink / raw)
  To: git

From: Peter Valdemar Mørch <peter@morch.com>

In commit 0706bd19ef9b41e7519df2c73796ef93484272fd $1 is used from a regexp
without using () to set up $1. Later, when that value was used, it caused a
warning about a variable being undefined.

Signed-off-by: Peter Valdemar Mørch <peter@morch.com>
---
The commit introduces $body_encoding and: $body_encoding = $1; which is undef.

That commit then later uses $body_encoding only here:
+ if ($has_content_type) {
+         if ($body_encoding eq $author_encoding) {
+                 # ok, we already have the right encoding
+         }
+         else {
+                 # uh oh, we should re-encode
+         }
+ }
(I removed some whitespace for readability)

.. and it was the eq that gave the warning, because $body_encoding was
undefined. Perhaps a better fix is to remove $body_encoding and regexp
altogether since it isn't really used. Let me know if you think so.

This is where my non-commit message goes, yeah? I'm hand editing the output of
'git format-patch'...

Junio C. Hamano commented on a previous post that I shouldn't send patches as
attachments so now I'm trying git-send-email. Are there any form problems with
this patch?

 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 2e4a44a..d2fd899 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -882,7 +882,7 @@ foreach my $t (@files) {
 				}
 				elsif (/^Content-type:/i) {
 					$has_content_type = 1;
-					if (/charset="?[^ "]+/) {
+					if (/charset="?([^ "]+)/) {
 						$body_encoding = $1;
 					}
 					push @xh, $_;
-- 
1.6.0.rc0.46.g07955.dirty

^ permalink raw reply related	[relevance 59%]

* [PATCH] send-email: Honor multi-part email messages
  @ 2013-01-25 15:28 59% ` Alexey Shumkin
  0 siblings, 0 replies; 200+ results
From: Alexey Shumkin @ 2013-01-25 15:28 UTC (permalink / raw)
  To: git; +Cc: Alexey Shumkin, Junio C Hamano, Krzysztof Mazur

"git format-patch --attach/--inline" generates multi-part messages.
Every part of such messages can contain non-ASCII characters with its own
"Content-Type" and "Content-Transfer-Encoding" headers.
But git-send-mail script interprets a patch-file as one-part message
and does not recognize multi-part messages.
So already quoted printable email subject may be encoded as quoted printable
again. Due to this bug email subject looks corrupted in email clients.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
---
 git-send-email.perl   |  5 ++++
 t/t9001-send-email.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)

diff --git a/git-send-email.perl b/git-send-email.perl
index 94c7f76..d49befe 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1499,12 +1499,17 @@ sub file_has_nonascii {
 
 sub body_or_subject_has_nonascii {
 	my $fn = shift;
+	my $multipart = 0;
 	open(my $fh, '<', $fn)
 		or die "unable to open $fn: $!\n";
 	while (my $line = <$fh>) {
 		last if $line =~ /^$/;
+		if ($line =~ /^Content-Type:\s*multipart\/mixed.*$/) {
+			$multipart = 1;
+		}
 		return 1 if $line =~ /^Subject.*[^[:ascii:]]/;
 	}
+	return 0 if $multipart;
 	while (my $line = <$fh>) {
 		return 1 if $line =~ /[^[:ascii:]]/;
 	}
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 97d6f4c..c7ed370 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1323,4 +1323,70 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
 	grep "^!someone@example\.org!$" commandline1
 '
 
+test_expect_success $PREREQ 'setup multi-part message' '
+cat >multi-part-email-using-8bit <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: author@example.com
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20?=
+ =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB?=
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="------------123"
+
+This is a multi-part message in MIME format.
+--------------1.7.6.3.4.gf71f
+Content-Type: text/plain; charset=UTF-8; format=fixed
+Content-Transfer-Encoding: 8bit
+
+This is a message created with "git format-patch --attach=123"
+---
+ master   |    1 +
+ файл |    1 +
+ 2 files changed, 2 insertions(+), 0 deletions(-)
+ create mode 100644 master
+ create mode 100644 файл
+
+
+--------------123
+Content-Type: text/x-patch; name="0001-.patch"
+Content-Transfer-Encoding: 8bit
+Content-Disposition: attachment; filename="0001-.patch"
+
+diff --git a/master b/master
+new file mode 100644
+index 0000000..1f7391f
+--- /dev/null
++++ b/master
+@@ -0,0 +1 @@
++master
+diff --git a/файл b/файл
+new file mode 100644
+index 0000000..44e5cfe
+--- /dev/null
++++ b/файл
+@@ -0,0 +1 @@
++содержимое файла
+
+--------------123--
+EOF
+'
+
+test_expect_success $PREREQ 'setup expect' '
+cat >expected <<EOF
+Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB?=
+EOF
+'
+
+test_expect_success $PREREQ '--attach/--inline also treats subject' '
+	clean_fake_sendmail &&
+	echo bogus |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--8bit-encoding=UTF-8 \
+			multi-part-email-using-8bit >stdout &&
+	grep "Subject" msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
 test_done
-- 
1.8.1.1.10.g9255f3f

^ permalink raw reply related	[relevance 59%]

* [PATCH] send-email: handle adjacent RFC 2047-encoded words properly
@ 2014-11-23 23:50 59% Роман Донченко
  0 siblings, 0 replies; 200+ results
From: Роман Донченко @ 2014-11-23 23:50 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Jay Soffian, Jeff King, Thomas Rast

The RFC says that they are to be concatenated after decoding (i.e. the
intervening whitespace is ignored).

I change the sender's name to an all-Cyrillic string in the tests so that
its encoded form goes over the 76 characters in a line limit, forcing
format-patch to split it into multiple encoded words.

Since I have to modify the regular expression for an encoded word anyway,
I take the opportunity to bring it closer to the spec, most notably
disallowing embedded spaces and making it case-insensitive (thus allowing
the encoding to be specified as both "q" and "Q").

Signed-off-by: Роман Донченко <dpb@corrigendum.ru>
---
 git-send-email.perl   | 21 +++++++++++++++------
 t/t9001-send-email.sh | 18 +++++++++---------
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 9949db0..4bb9f6f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -913,13 +913,22 @@ $time = time - scalar $#files;
 
 sub unquote_rfc2047 {
 	local ($_) = @_;
+
+	my $et = qr/[!->@-~]+/; # encoded-text from RFC 2047
+	my $sep = qr/[ \t]+/;
+	my $encoded_word = qr/=\?($et)\?q\?($et)\?=/i;
+
 	my $encoding;
-	s{=\?([^?]+)\?q\?(.*?)\?=}{
-		$encoding = $1;
-		my $e = $2;
-		$e =~ s/_/ /g;
-		$e =~ s/=([0-9A-F]{2})/chr(hex($1))/eg;
-		$e;
+	s{$encoded_word(?:$sep$encoded_word)+}{
+		my @words = split $sep, $&;
+		foreach (@words) {
+			m/$encoded_word/;
+			$encoding = $1;
+			$_ = $2;
+			s/_/ /g;
+			s/=([0-9A-F]{2})/chr(hex($1))/eg;
+		}
+		join '', @words;
 	}eg;
 	return wantarray ? ($_, $encoding) : $_;
 }
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 19a3ced..318b870 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -236,7 +236,7 @@ test_expect_success $PREREQ 'self name with dot is suppressed' "
 "
 
 test_expect_success $PREREQ 'non-ascii self name is suppressed' "
-	test_suppress_self_quoted 'Füñný Nâmé' 'odd_?=mail@example.com' \
+	test_suppress_self_quoted 'Кириллическое Имя' 'odd_?=mail@example.com' \
 		'non_ascii_self_suppressed'
 "
 
@@ -946,25 +946,25 @@ test_expect_success $PREREQ 'utf8 author is correctly passed on' '
 	clean_fake_sendmail &&
 	test_commit weird_author &&
 	test_when_finished "git reset --hard HEAD^" &&
-	git commit --amend --author "Füñný Nâmé <odd_?=mail@example.com>" &&
-	git format-patch --stdout -1 >funny_name.patch &&
+	git commit --amend --author "Кириллическое Имя <odd_?=mail@example.com>" &&
+	git format-patch --stdout -1 >nonascii_name.patch &&
 	git send-email --from="Example <nobody@example.com>" \
 	  --to=nobody@example.com \
 	  --smtp-server="$(pwd)/fake.sendmail" \
-	  funny_name.patch &&
-	grep "^From: Füñný Nâmé <odd_?=mail@example.com>" msgtxt1
+	  nonascii_name.patch &&
+	grep "^From: Кириллическое Имя <odd_?=mail@example.com>" msgtxt1
 '
 
 test_expect_success $PREREQ 'utf8 sender is not duplicated' '
 	clean_fake_sendmail &&
 	test_commit weird_sender &&
 	test_when_finished "git reset --hard HEAD^" &&
-	git commit --amend --author "Füñný Nâmé <odd_?=mail@example.com>" &&
-	git format-patch --stdout -1 >funny_name.patch &&
-	git send-email --from="Füñný Nâmé <odd_?=mail@example.com>" \
+	git commit --amend --author "Кириллическое Имя <odd_?=mail@example.com>" &&
+	git format-patch --stdout -1 >nonascii_name.patch &&
+	git send-email --from="Кириллическое Имя <odd_?=mail@example.com>" \
 	  --to=nobody@example.com \
 	  --smtp-server="$(pwd)/fake.sendmail" \
-	  funny_name.patch &&
+	  nonascii_name.patch &&
 	grep "^From: " msgtxt1 >msgfrom &&
 	test_line_count = 1 msgfrom
 '
-- 
2.1.1

^ permalink raw reply related	[relevance 59%]

* [PATCH 02/12] send-email: avoid creating more than one Term::ReadLine object
  @ 2024-05-21 19:56 59% ` Junio C Hamano
  2024-05-21 19:56 53% ` [PATCH 01/12] send-email: drop FakeTerm hack Junio C Hamano
  1 sibling, 0 replies; 200+ results
From: Junio C Hamano @ 2024-05-21 19:56 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Taylor Blau

From: Jeff King <peff@peff.net>

Every time git-send-email calls its ask() function to prompt the user,
we call term(), which instantiates a new Term::ReadLine object. But in
v1.46 of Term::ReadLine::Gnu (which provides the Term::ReadLine
interface on some platforms), its constructor refuses to create a second
instance[1]. So on systems with that version of the module, most
git-send-email instances will fail (as we usually prompt for both "to"
and "in-reply-to" unless the user provided them on the command line).

We can fix this by keeping a single instance variable and returning it
for each call to term(). In perl 5.10 and up, we could do that with a
"state" variable. But since we only require 5.008, we'll do it the
old-fashioned way, with a lexical "my" in its own scope.

Note that the tests in t9001 detect this problem as-is, since the
failure mode is for the program to die. But let's also beef up the
"Prompting works" test to check that it correctly handles multiple
inputs (if we had chosen to keep our FakeTerm hack in the previous
commit, then the failure mode would be incorrectly ignoring prompts
after the first).

[1] For discussion of why multiple instances are forbidden, see:
    https://github.com/hirooih/perl-trg/issues/16

[jc: cherry-picked from v2.42.0-rc2~6^2]

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-send-email.perl   | 18 +++++++++++++-----
 t/t9001-send-email.sh |  5 +++--
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 72d876f0a0..ad51508790 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -917,11 +917,19 @@ sub get_patch_subject {
 	do_edit(@files);
 }
 
-sub term {
-	require Term::ReadLine;
-	return $ENV{"GIT_SEND_EMAIL_NOTTY"}
-			? Term::ReadLine->new('git-send-email', \*STDIN, \*STDOUT)
-			: Term::ReadLine->new('git-send-email');
+{
+	# Only instantiate one $term per program run, since some
+	# Term::ReadLine providers refuse to create a second instance.
+	my $term;
+	sub term {
+		require Term::ReadLine;
+		if (!defined $term) {
+			$term = $ENV{"GIT_SEND_EMAIL_NOTTY"}
+				? Term::ReadLine->new('git-send-email', \*STDIN, \*STDOUT)
+				: Term::ReadLine->new('git-send-email');
+		}
+		return $term;
+	}
 }
 
 sub ask {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1130ef21b3..0f08a9542b 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -337,13 +337,14 @@ test_expect_success $PREREQ 'Show all headers' '
 test_expect_success $PREREQ 'Prompting works' '
 	clean_fake_sendmail &&
 	(echo "to@example.com" &&
-	 echo ""
+	 echo "my-message-id@example.com"
 	) | GIT_SEND_EMAIL_NOTTY=1 git send-email \
 		--smtp-server="$(pwd)/fake.sendmail" \
 		$patches \
 		2>errors &&
 		grep "^From: A U Thor <author@example.com>\$" msgtxt1 &&
-		grep "^To: to@example.com\$" msgtxt1
+		grep "^To: to@example.com\$" msgtxt1 &&
+		grep "^In-Reply-To: <my-message-id@example.com>" msgtxt1
 '
 
 test_expect_success $PREREQ,AUTOIDENT 'implicit ident is allowed' '
-- 
2.45.1-216-g4365c6fcf9



^ permalink raw reply related	[relevance 59%]

* Re: git-send-email getting filtered as spam by vger.kernel.org
  @ 2008-02-21 21:14 59%     ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2008-02-21 21:14 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Len Brown, git

Uwe Kleine-König  <ukleinek@informatik.uni-freiburg.de> writes:

> Len Brown wrote:
>> It looks like the same patches formatted and set with git 1.5.4.2
>> made it through to the list.
> I suspect 1ca3d6ed01774eab37e96d9c88b840ea618f97af.

When you talk about commits, please also add the summary line,
like this [*1*]:

    1ca3d6e (send-email: squelch warning due to comparing undefined $_ to "")

Len said he has the issue with v1.5.4.2-184-gb23b27e but not
with v1.5.4.2.

    $ git lg v1.5.4.2..b23b27e -- git-send-email.perl
    1ca3d6e... send-email: squelch warning due to comparing undefined $_ to ""
    6564828... git-send-email: Generalize auto-cc recipient mechanism.
    8a7c56e... git-send-email: Better handling of EOF
    8742997... git-send-email: SIG{TERM,INT} handlers
    2363d74... git-send-email: ssh/login style password requests

and I think you are right.  I see In-reply-to: <> in the reject
message.

Perhaps we should fix it up like this...


diff --git a/git-send-email.perl b/git-send-email.perl
index ccb87a2..c9f8c6b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -475,7 +475,7 @@ if ($thread && !defined $initial_reply_to && $prompting) {
 
 	$initial_reply_to = $_;
 }
-if (defined $initial_reply_to) {
+if (defined $initial_reply_to && $initial_reply_to ne '') {
 	$initial_reply_to =~ s/^\s*<?/</;
 	$initial_reply_to =~ s/>?\s*$/>/;
 }



[Footnote]

*1* Here is what I have in $HOME/.gitconfig to allow me to say
"git one 1ca3d6ed0177".

[alias]
	lg = log --pretty=oneline --abbrev-commit
	one = show -s --pretty='format:%h (%s)'

^ permalink raw reply related	[relevance 59%]

* [PATCH 1/2] Move SCM interoperability tools into interop/
  @ 2006-07-10  4:54 59% ` Ryan Anderson
  0 siblings, 0 replies; 200+ results
From: Ryan Anderson @ 2006-07-10  4:54 UTC (permalink / raw)
  To: git; +Cc: Ryan Anderson

Signed-off-by: Ryan Anderson <ryan@michonline.com>
---
 Makefile                                           |   12 +++--
 interop/Makefile                                   |   45 ++++++++++++++++++++
 git-archimport.perl => interop/git-archimport.perl |    0 
 .../git-cvsexportcommit.perl                       |    0 
 git-cvsimport.perl => interop/git-cvsimport.perl   |    0 
 git-cvsserver.perl => interop/git-cvsserver.perl   |    0 
 git-p4import.py => interop/git-p4import.py         |    0 
 git-quiltimport.sh => interop/git-quiltimport.sh   |    0 
 git-send-email.perl => interop/git-send-email.perl |    0 
 git-svnimport.perl => interop/git-svnimport.perl   |    0 
 10 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 13f7c89..d6e2b0f 100644
--- a/Makefile
+++ b/Makefile
@@ -127,14 +127,13 @@ SCRIPT_SH = \
 	git-applymbox.sh git-applypatch.sh git-am.sh \
 	git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
 	git-merge-resolve.sh git-merge-ours.sh \
-	git-lost-found.sh git-quiltimport.sh
+	git-lost-found.sh
 
 SCRIPT_PERL = \
-	git-archimport.perl git-cvsimport.perl git-relink.perl \
+	git-relink.perl \
 	git-shortlog.perl git-rerere.perl \
-	git-annotate.perl git-cvsserver.perl \
-	git-svnimport.perl git-mv.perl git-cvsexportcommit.perl \
-	git-send-email.perl
+	git-annotate.perl \
+	git-mv.perl
 
 SCRIPT_PYTHON = \
 	git-merge-recursive.py
@@ -176,6 +175,9 @@ BUILT_INS = git-log$X git-whatchanged$X 
 	git-diff-index$X git-diff-stages$X git-diff-tree$X git-cat-file$X \
 	git-fmt-merge-msg$X
 
+
+include interop/Makefile
+
 # what 'all' will build and 'install' will install, in gitexecdir
 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
 
diff --git a/interop/Makefile b/interop/Makefile
new file mode 100644
index 0000000..b1a11d1
--- /dev/null
+++ b/interop/Makefile
@@ -0,0 +1,45 @@
+
+INTEROP_PERL_BASE = \
+	git-archimport.perl \
+	git-cvsimport.perl \
+	git-cvsexportcommit.perl \
+	git-cvsserver.perl \
+	git-svnimport.perl \
+	git-send-email.perl
+
+INTEROP_PYTHON_BASE = \
+	git-p4import.py
+
+INTEROP_SH_BASE = \
+	git-quiltimport.sh
+
+SCRIPTS+=$(patsubst %.perl,%,$(INTEROP_PERL_BASE))
+SCRIPTS+=$(patsubst %.py,%,$(INTEROP_PYTHON_BASE))
+SCRIPTS+=$(patsubst %.sh,%,$(INTEROP_SH_BASE))
+
+$(patsubst %.sh,%,$(INTEROP_SH_BASE)) : % : interop/%.sh
+	rm -f $@ $@+
+	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
+	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+	    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
+	    -e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \
+	    $^ >$@+
+	chmod +x $@+
+	mv $@+ $@
+
+$(patsubst %.perl,%,$(INTEROP_PERL_BASE)) : % : interop/%.perl
+	rm -f $@ $@+
+	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+	    $^ >$@+
+	chmod +x $@+
+	mv $@+ $@
+
+$(patsubst %.py,%,$(INTEROP_PYTHON_BASE)) : % : interop/%.py GIT-CFLAGS
+	rm -f $@ $@+
+	sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
+	    -e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR_SQ)|g' \
+	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+	    $^ >$@+
+	chmod +x $@+
+	mv $@+ $@
diff --git a/git-archimport.perl b/interop/git-archimport.perl
similarity index 100%
rename from git-archimport.perl
rename to interop/git-archimport.perl
diff --git a/git-cvsexportcommit.perl b/interop/git-cvsexportcommit.perl
similarity index 100%
rename from git-cvsexportcommit.perl
rename to interop/git-cvsexportcommit.perl
diff --git a/git-cvsimport.perl b/interop/git-cvsimport.perl
similarity index 100%
rename from git-cvsimport.perl
rename to interop/git-cvsimport.perl
diff --git a/git-cvsserver.perl b/interop/git-cvsserver.perl
similarity index 100%
rename from git-cvsserver.perl
rename to interop/git-cvsserver.perl
diff --git a/git-p4import.py b/interop/git-p4import.py
similarity index 100%
rename from git-p4import.py
rename to interop/git-p4import.py
diff --git a/git-quiltimport.sh b/interop/git-quiltimport.sh
similarity index 100%
rename from git-quiltimport.sh
rename to interop/git-quiltimport.sh
diff --git a/git-send-email.perl b/interop/git-send-email.perl
similarity index 100%
rename from git-send-email.perl
rename to interop/git-send-email.perl
diff --git a/git-svnimport.perl b/interop/git-svnimport.perl
similarity index 100%
rename from git-svnimport.perl
rename to interop/git-svnimport.perl
-- 
1.4.1.gc473b-dirty

^ permalink raw reply related	[relevance 59%]

* [PATCH v2 1/2] send-email: sanitize author when writing From line
@ 2013-06-20 12:27 59% Michael S. Tsirkin
  0 siblings, 0 replies; 200+ results
From: Michael S. Tsirkin @ 2013-06-20 12:27 UTC (permalink / raw)
  To: git; +Cc: =?UTF-8?q?SZEDER=20G=C3=A1bor?=

sender is now sanitized, but we didn't sanitize
author when checking whether From: line is needed
in the message body.
As a result git started writing duplicate From lines
when author matched sender and has utf8 characters.

Reported-by: SZEDER Gábor <szeder@ira.uka.de>
Tested-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 git-send-email.perl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 671762b..ecbf56f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1259,6 +1259,7 @@ foreach my $t (@files) {
 	open my $fh, "<", $t or die "can't open file $t";
 
 	my $author = undef;
+	my $sauthor = undef;
 	my $author_encoding;
 	my $has_content_type;
 	my $body_encoding;
@@ -1297,7 +1298,7 @@ foreach my $t (@files) {
 			}
 			elsif (/^From:\s+(.*)$/i) {
 				($author, $author_encoding) = unquote_rfc2047($1);
-				my $sauthor = sanitize_address($author);
+				$sauthor = sanitize_address($author);
 				next if $suppress_cc{'author'};
 				next if $suppress_cc{'self'} and $sauthor eq $sender;
 				printf("(mbox) Adding cc: %s from line '%s'\n",
@@ -1393,7 +1394,7 @@ foreach my $t (@files) {
 		$subject = quote_subject($subject, $auto_8bit_encoding);
 	}
 
-	if (defined $author and $author ne $sender) {
+	if (defined $sauthor and $sauthor ne $sender) {
 		$message = "From: $author\n\n$message";
 		if (defined $author_encoding) {
 			if ($has_content_type) {
-- 
MST

^ permalink raw reply related	[relevance 59%]

* [PATCH] send-email: Honor multi-part email messages
@ 2011-09-20  8:29 59% Alexey Shumkin
  0 siblings, 0 replies; 200+ results
From: Alexey Shumkin @ 2011-09-20  8:29 UTC (permalink / raw)
  To: git; +Cc: Alexey Shumkin, Junio C Hamano

"git format-patch --attach/--inline" generates multi-part messages.
Every part of such messages can contain non-ASCII characters with its own
"Content-Type" and "Content-Transfer-Encoding" headers.
But git-send-mail script interprets a patch-file as one-part message
and does not recognize multi-part messages.
So already quoted printable email subject may be encoded as quoted printable
again. Due to this bug email subject looks corrupted in email clients.

Signed-off-by: Alexey Shumkin <zapped@mail.ru>
---
 git-send-email.perl   |    5 +++
 t/t9001-send-email.sh |   66 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 98ab33a..1abf4a4 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1403,12 +1403,17 @@ sub file_has_nonascii {
 
 sub body_or_subject_has_nonascii {
 	my $fn = shift;
+	my $multipart = 0;
 	open(my $fh, '<', $fn)
 		or die "unable to open $fn: $!\n";
 	while (my $line = <$fh>) {
 		last if $line =~ /^$/;
+		if ($line =~ /^Content-Type:\s*multipart\/mixed.*$/) {
+			$multipart = 1;
+		}
 		return 1 if $line =~ /^Subject.*[^[:ascii:]]/;
 	}
+	return 0 if $multipart;
 	while (my $line = <$fh>) {
 		return 1 if $line =~ /[^[:ascii:]]/;
 	}
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 579ddb7..151ad35 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1168,4 +1168,70 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '
 	test -n "$(ls msgtxt*)"
 '
 
+test_expect_success $PREREQ 'setup multi-part message' '
+cat >multi-part-email-using-8bit <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: author@example.com
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20?=
+ =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB?=
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="------------123"
+
+This is a multi-part message in MIME format.
+--------------1.7.6.3.4.gf71f
+Content-Type: text/plain; charset=UTF-8; format=fixed
+Content-Transfer-Encoding: 8bit
+
+This is a message created with "git format-patch --attach=123"
+---
+ master   |    1 +
+ файл |    1 +
+ 2 files changed, 2 insertions(+), 0 deletions(-)
+ create mode 100644 master
+ create mode 100644 файл
+
+
+--------------123
+Content-Type: text/x-patch; name="0001-.patch"
+Content-Transfer-Encoding: 8bit
+Content-Disposition: attachment; filename="0001-.patch"
+
+diff --git a/master b/master
+new file mode 100644
+index 0000000..1f7391f
+--- /dev/null
++++ b/master
+@@ -0,0 +1 @@
++master
+diff --git a/файл b/файл
+new file mode 100644
+index 0000000..44e5cfe
+--- /dev/null
++++ b/файл
+@@ -0,0 +1 @@
++содержимое файла
+
+--------------123--
+EOF
+'
+
+test_expect_success $PREREQ 'setup expect' '
+cat >expected <<EOF
+Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB?=
+EOF
+'
+
+test_expect_success $PREREQ '--attach/--inline also treats subject' '
+	clean_fake_sendmail &&
+	echo bogus |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--8bit-encoding=UTF-8 \
+			multi-part-email-using-8bit >stdout &&
+	grep "Subject" msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
 test_done
-- 
1.7.6.3.4.gf71f

^ permalink raw reply related	[relevance 59%]

* [PATCH] send-email: Honor multi-part email messages
@ 2011-09-16 22:32 59% Alexey Shumkin
  0 siblings, 0 replies; 200+ results
From: Alexey Shumkin @ 2011-09-16 22:32 UTC (permalink / raw)
  To: git; +Cc: Alexey Shumkin

"git format-patch --attach/--inline" generates multi-part messages.
Every part of such messages can contain non-ASCII characters with its own
"Content-Type" and "Content-Transfer-Encoding" headers.
But git-send-mail script interprets a patch-file as one-part message
and does not recognize multi-part messages.
So already quoted printable email subject may be encoded as quoted printable
again. Due to this bug email subject looks corrupted in email clients.

Signed-off-by: Alexey Shumkin <zapped@mail.ru>
---
 git-send-email.perl   |    5 +++
 t/t9001-send-email.sh |   66 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 98ab33a..1abf4a4 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1403,12 +1403,17 @@ sub file_has_nonascii {
 
 sub body_or_subject_has_nonascii {
 	my $fn = shift;
+	my $multipart = 0;
 	open(my $fh, '<', $fn)
 		or die "unable to open $fn: $!\n";
 	while (my $line = <$fh>) {
 		last if $line =~ /^$/;
+		if ($line =~ /^Content-Type:\s*multipart\/mixed.*$/) {
+			$multipart = 1;
+		}
 		return 1 if $line =~ /^Subject.*[^[:ascii:]]/;
 	}
+	return 0 if $multipart;
 	while (my $line = <$fh>) {
 		return 1 if $line =~ /[^[:ascii:]]/;
 	}
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 579ddb7..151ad35 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1168,4 +1168,70 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '
 	test -n "$(ls msgtxt*)"
 '
 
+test_expect_success $PREREQ 'setup multi-part message' '
+cat >multi-part-email-using-8bit <<EOF
+From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
+Message-Id: <bogus-message-id@example.com>
+From: author@example.com
+Date: Sat, 12 Jun 2010 15:53:58 +0200
+Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20?=
+ =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB?=
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="------------123"
+
+This is a multi-part message in MIME format.
+--------------1.7.6.3.4.gf71f
+Content-Type: text/plain; charset=UTF-8; format=fixed
+Content-Transfer-Encoding: 8bit
+
+This is a message created with "git format-patch --attach=123"
+---
+ master   |    1 +
+ файл |    1 +
+ 2 files changed, 2 insertions(+), 0 deletions(-)
+ create mode 100644 master
+ create mode 100644 файл
+
+
+--------------123
+Content-Type: text/x-patch; name="0001-.patch"
+Content-Transfer-Encoding: 8bit
+Content-Disposition: attachment; filename="0001-.patch"
+
+diff --git a/master b/master
+new file mode 100644
+index 0000000..1f7391f
+--- /dev/null
++++ b/master
+@@ -0,0 +1 @@
++master
+diff --git a/файл b/файл
+new file mode 100644
+index 0000000..44e5cfe
+--- /dev/null
++++ b/файл
+@@ -0,0 +1 @@
++содержимое файла
+
+--------------123--
+EOF
+'
+
+test_expect_success $PREREQ 'setup expect' '
+cat >expected <<EOF
+Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB?=
+EOF
+'
+
+test_expect_success $PREREQ '--attach/--inline also treats subject' '
+	clean_fake_sendmail &&
+	echo bogus |
+	git send-email --from=author@example.com --to=nobody@example.com \
+			--smtp-server="$(pwd)/fake.sendmail" \
+			--8bit-encoding=UTF-8 \
+			multi-part-email-using-8bit >stdout &&
+	grep "Subject" msgtxt1 >actual &&
+	test_cmp expected actual
+'
+
 test_done
-- 
1.7.6.3.4.gf71f

^ permalink raw reply related	[relevance 59%]

* [PATCH] send-email: add transfer encoding header with content-type
  @ 2007-11-20 12:54 59%       ` Jeff King
  0 siblings, 0 replies; 200+ results
From: Jeff King @ 2007-11-20 12:54 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Junio C Hamano, git, Brian Swetland, Russell King - ARM Linux,
	Nicolas Pitre

We add the content-type header only when we have non-7bit
characters from the 'From' header, so we really need to
specify the encoding (in other cases, where the commit text
needed a content-type, git-format-patch will already have
added the encoding header).

Signed-off-by: Jeff King <peff@peff.net>
---
On Mon, Nov 19, 2007 at 11:49:50AM +0100, Uwe Kleine-König wrote:

> but no Content-Transfer-Encoding:.  This yield a 7bit mail with 8bit
> characters.
> 
> I think we should add
> 
> 	Content-Transfer-Encoding: 8bit

Even though Brian's mail turned out to be hand-generated, this problem
does exist in git-send-email. I don't know why I didn't add the encoding
header in the first place, since it is clearly required.

Junio, I think this is maint-worthy.

 git-send-email.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index fd0a4ad..d7b8391 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -781,7 +781,8 @@ foreach my $t (@files) {
 			else {
 				push @xh,
 				  'MIME-Version: 1.0',
-				  "Content-Type: text/plain; charset=$author_encoding";
+				  "Content-Type: text/plain; charset=$author_encoding",
+				  'Content-Transfer-Encoding: 8bit';
 			}
 		}
 	}
-- 
1.5.3.6.1784.gd1b1d-dirty

^ permalink raw reply related	[relevance 59%]

* [PATCH 1/2] send-email: sanitize author when writing From line
@ 2013-06-18 12:49 60% Michael S. Tsirkin
  0 siblings, 0 replies; 200+ results
From: Michael S. Tsirkin @ 2013-06-18 12:49 UTC (permalink / raw)
  To: git; +Cc: =?UTF-8?q?SZEDER=20G=C3=A1bor?=

sender is now sanitized, but we didn't sanitize
author when checking whether From: line is needed
in the message body.
As a result git started writing duplicate From lines
when author matched sender and has utf8 characters.

Reported-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 git-send-email.perl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 671762b..ecbf56f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1259,6 +1259,7 @@ foreach my $t (@files) {
 	open my $fh, "<", $t or die "can't open file $t";
 
 	my $author = undef;
+	my $sauthor = undef;
 	my $author_encoding;
 	my $has_content_type;
 	my $body_encoding;
@@ -1297,7 +1298,7 @@ foreach my $t (@files) {
 			}
 			elsif (/^From:\s+(.*)$/i) {
 				($author, $author_encoding) = unquote_rfc2047($1);
-				my $sauthor = sanitize_address($author);
+				$sauthor = sanitize_address($author);
 				next if $suppress_cc{'author'};
 				next if $suppress_cc{'self'} and $sauthor eq $sender;
 				printf("(mbox) Adding cc: %s from line '%s'\n",
@@ -1393,7 +1394,7 @@ foreach my $t (@files) {
 		$subject = quote_subject($subject, $auto_8bit_encoding);
 	}
 
-	if (defined $author and $author ne $sender) {
+	if (defined $sauthor and $sauthor ne $sender) {
 		$message = "From: $author\n\n$message";
 		if (defined $author_encoding) {
 			if ($has_content_type) {
-- 
MST

^ permalink raw reply related	[relevance 60%]

* [PATCH V4] git-send-email.perl: Add --to-cmd
  @ 2010-09-24 17:03 60%                                   ` Joe Perches
  0 siblings, 0 replies; 200+ results
From: Joe Perches @ 2010-09-24 17:03 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Jakub Narebski, Junio C Hamano, Julia Lawall, git,
	Vasiliy Kulikov, Matt Mooney, kernel-janitors, Dan Carpenter

Add the ability to use a command line --to-cmd=cmd
to create the list of "To:" addresses.

Used a shared routine for --cc-cmd and --to-cmd.

Did not use IPC::Open2, leaving that for Ævar if
ever he decides to fix the other bugs he might find.

Signed-off-by: Joe Perches <joe@perches.com>
---
 Documentation/git-send-email.txt |    8 +++++-
 git-send-email.perl              |   51 +++++++++++++++++++++++++------------
 t/t9001-send-email.sh            |   18 +++++++++++++
 3 files changed, 59 insertions(+), 18 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index c283084..fff97a3 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -97,7 +97,7 @@ See the CONFIGURATION section for 'sendemail.multiedit'.
 	Specify the primary recipient of the emails generated. Generally, this
 	will be the upstream maintainer of the project involved. Default is the
 	value of the 'sendemail.to' configuration value; if that is unspecified,
-	this will be prompted for.
+	and --to-cmd is not specified, this will be prompted for.
 +
 The --to option must be repeated for each user you want on the to list.
 
@@ -177,6 +177,12 @@ user is prompted for a password while the input is masked for privacy.
 Automating
 ~~~~~~~~~~
 
+--to-cmd=<command>::
+	Specify a command to execute once per patch file which
+	should generate patch file specific "To:" entries.
+	Output of this command must be single email address per line.
+	Default is the value of 'sendemail.tocmd' configuration value.
+
 --cc-cmd=<command>::
 	Specify a command to execute once per patch file which
 	should generate patch file specific "Cc:" entries.
diff --git a/git-send-email.perl b/git-send-email.perl
index 6dab3bf..3acfdc2 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -70,6 +70,7 @@ git send-email [options] <file | directory | rev-list options >
 
   Automating:
     --identity              <str>  * Use the sendemail.<id> options.
+    --to-cmd                <str>  * Email To: via `<str> \$patch_path`
     --cc-cmd                <str>  * Email Cc: via `<str> \$patch_path`
     --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, bodycc, all.
     --[no-]signed-off-by-cc        * Send to Signed-off-by: addresses. Default on.
@@ -187,7 +188,8 @@ sub do_edit {
 }
 
 # Variables with corresponding config settings
-my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
+my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);
+my ($to_cmd, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts, $smtp_domain);
 my ($validate, $confirm);
@@ -214,6 +216,7 @@ my %config_settings = (
     "smtppass" => \$smtp_authpass,
 	"smtpdomain" => \$smtp_domain,
     "to" => \@to,
+    "tocmd" => \$to_cmd,
     "cc" => \@initial_cc,
     "cccmd" => \$cc_cmd,
     "aliasfiletype" => \$aliasfiletype,
@@ -272,6 +275,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
                     "in-reply-to=s" => \$initial_reply_to,
 		    "subject=s" => \$initial_subject,
 		    "to=s" => \@to,
+		    "to-cmd=s" => \$to_cmd,
 		    "no-to" => \$no_to,
 		    "cc=s" => \@initial_cc,
 		    "no-cc" => \$no_cc,
@@ -711,7 +715,7 @@ if (!defined $sender) {
 	$prompting++;
 }
 
-if (!@to) {
+if (!@to && !defined $to_cmd) {
 	my $to = ask("Who should the emails be sent to? ");
 	push @to, parse_address_line($to) if defined $to; # sanitized/validated later
 	$prompting++;
@@ -1238,21 +1242,10 @@ foreach my $t (@files) {
 	}
 	close F;
 
-	if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
-		open(F, "$cc_cmd \Q$t\E |")
-			or die "(cc-cmd) Could not execute '$cc_cmd'";
-		while(<F>) {
-			my $c = $_;
-			$c =~ s/^\s*//g;
-			$c =~ s/\n$//g;
-			next if ($c eq $sender and $suppress_from);
-			push @cc, $c;
-			printf("(cc-cmd) Adding cc: %s from: '%s'\n",
-				$c, $cc_cmd) unless $quiet;
-		}
-		close F
-			or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
-	}
+	push @to, recipients_cmd("to-cmd", "to", $to_cmd, $t)
+		if defined $to_cmd;
+	push @cc, recipients_cmd("cc-cmd", "cc", $cc_cmd, $t)
+		if defined $cc_cmd && !$suppress_cc{'cccmd'};
 
 	if ($broken_encoding{$t} && !$has_content_type) {
 		$has_content_type = 1;
@@ -1310,6 +1303,30 @@ foreach my $t (@files) {
 	$message_id = undef;
 }
 
+# Execute a command (ie: $to_cmd) to get a list of email addresses
+# and return a results array
+sub recipients_cmd {
+	my ($prefix, $what, $cmd, $file) = @_;
+
+	my $sanitized_sender = sanitize_address($sender);
+	my @addresses = ();
+	open(F, "$cmd \Q$file\E |")
+	    or die "($prefix) Could not execute '$cmd'";
+	while(<F>) {
+		my $address = $_;
+		$address =~ s/^\s*//g;
+		$address =~ s/\s*$//g;
+		$address = sanitize_address($address);
+		next if ($address eq $sanitized_sender and $suppress_from);
+		push @addresses, $address;
+		printf("($prefix) Adding %s: %s from: '%s'\n",
+		       $what, $address, $cmd) unless $quiet;
+		}
+	close F
+	    or die "($prefix) failed to close pipe to '$cmd'";
+	return @addresses;
+}
+
 cleanup_compose_files();
 
 sub cleanup_compose_files() {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 71b3df9..36cf421 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -201,6 +201,24 @@ test_expect_success $PREREQ 'Prompting works' '
 		grep "^To: to@example.com\$" msgtxt1
 '
 
+test_expect_success $PREREQ 'tocmd works' '
+	clean_fake_sendmail &&
+	cp $patches tocmd.patch &&
+	echo tocmd--tocmd@example.com >>tocmd.patch &&
+	{
+	  echo "#!$SHELL_PATH"
+	  echo sed -n -e s/^tocmd--//p \"\$1\"
+	} > tocmd-sed &&
+	chmod +x tocmd-sed &&
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--to-cmd=./tocmd-sed \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		tocmd.patch \
+		&&
+	grep "^To: tocmd@example.com" msgtxt1
+'
+
 test_expect_success $PREREQ 'cccmd works' '
 	clean_fake_sendmail &&
 	cp $patches cccmd.patch &&

^ permalink raw reply related	[relevance 60%]

* [PATCH V3] git-send-email.perl: Add --to-cmd
  @ 2010-09-24  1:18 60%                           ` Joe Perches
    0 siblings, 1 reply; 200+ results
From: Joe Perches @ 2010-09-24  1:18 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Ævar Arnfjörð Bjarmason, Julia Lawall, git,
	Vasiliy Kulikov, matt mooney, kernel-janitors, Dan Carpenter

Add the ability to use a command line --to-cmd=cmd
to create the list of "To:" addresses.

Used a shared routine for --cc-cmd and --to-cmd.

Did not use IPC::Open2, leaving that for Ævar if
ever he decides to fix the other bugs he might find.

Signed-off-by: Joe Perches <joe@perches.com>
---
 Documentation/git-send-email.txt |    8 +++++-
 git-send-email.perl              |   51 +++++++++++++++++++++++++------------
 t/t9001-send-email.sh            |   18 +++++++++++++
 3 files changed, 59 insertions(+), 18 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index c283084..fff97a3 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -97,7 +97,7 @@ See the CONFIGURATION section for 'sendemail.multiedit'.
 	Specify the primary recipient of the emails generated. Generally, this
 	will be the upstream maintainer of the project involved. Default is the
 	value of the 'sendemail.to' configuration value; if that is unspecified,
-	this will be prompted for.
+	and --to-cmd is not specified, this will be prompted for.
 +
 The --to option must be repeated for each user you want on the to list.
 
@@ -177,6 +177,12 @@ user is prompted for a password while the input is masked for privacy.
 Automating
 ~~~~~~~~~~
 
+--to-cmd=<command>::
+	Specify a command to execute once per patch file which
+	should generate patch file specific "To:" entries.
+	Output of this command must be single email address per line.
+	Default is the value of 'sendemail.tocmd' configuration value.
+
 --cc-cmd=<command>::
 	Specify a command to execute once per patch file which
 	should generate patch file specific "Cc:" entries.
diff --git a/git-send-email.perl b/git-send-email.perl
index 6dab3bf..e148269 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -70,6 +70,7 @@ git send-email [options] <file | directory | rev-list options >
 
   Automating:
     --identity              <str>  * Use the sendemail.<id> options.
+    --to-cmd                <str>  * Email To: via `<str> \$patch_path`
     --cc-cmd                <str>  * Email Cc: via `<str> \$patch_path`
     --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, bodycc, all.
     --[no-]signed-off-by-cc        * Send to Signed-off-by: addresses. Default on.
@@ -187,7 +188,8 @@ sub do_edit {
 }
 
 # Variables with corresponding config settings
-my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
+my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);
+my ($to_cmd, $cc_cmd);
 my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
 my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts, $smtp_domain);
 my ($validate, $confirm);
@@ -214,6 +216,7 @@ my %config_settings = (
     "smtppass" => \$smtp_authpass,
 	"smtpdomain" => \$smtp_domain,
     "to" => \@to,
+    "tocmd" => \$to_cmd,
     "cc" => \@initial_cc,
     "cccmd" => \$cc_cmd,
     "aliasfiletype" => \$aliasfiletype,
@@ -272,6 +275,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
                     "in-reply-to=s" => \$initial_reply_to,
 		    "subject=s" => \$initial_subject,
 		    "to=s" => \@to,
+		    "to-cmd=s" => \$to_cmd,
 		    "no-to" => \$no_to,
 		    "cc=s" => \@initial_cc,
 		    "no-cc" => \$no_cc,
@@ -711,7 +715,7 @@ if (!defined $sender) {
 	$prompting++;
 }
 
-if (!@to) {
+if (!@to && !defined $to_cmd) {
 	my $to = ask("Who should the emails be sent to? ");
 	push @to, parse_address_line($to) if defined $to; # sanitized/validated later
 	$prompting++;
@@ -1238,21 +1242,10 @@ foreach my $t (@files) {
 	}
 	close F;
 
-	if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
-		open(F, "$cc_cmd \Q$t\E |")
-			or die "(cc-cmd) Could not execute '$cc_cmd'";
-		while(<F>) {
-			my $c = $_;
-			$c =~ s/^\s*//g;
-			$c =~ s/\n$//g;
-			next if ($c eq $sender and $suppress_from);
-			push @cc, $c;
-			printf("(cc-cmd) Adding cc: %s from: '%s'\n",
-				$c, $cc_cmd) unless $quiet;
-		}
-		close F
-			or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
-	}
+	push @to, recipients_cmd("to-cmd", "to", $to_cmd, $t)
+		if defined $to_cmd;
+	push @cc, recipients_cmd("cc-cmd", "cc", $cc_cmd, $t)
+		if defined $cc_cmd && !$suppress_cc{'cccmd'};
 
 	if ($broken_encoding{$t} && !$has_content_type) {
 		$has_content_type = 1;
@@ -1310,6 +1303,30 @@ foreach my $t (@files) {
 	$message_id = undef;
 }
 
+# Execute a command (ie: $to_cmd) to get a list of email addresses
+# and return a results array
+sub recipients_cmd(@) {
+	my ($prefix, $what, $cmd, $file) = @_;
+
+	my $sanitized_sender = sanitize_address($sender);
+	my @addresses = ();
+	open(F, "$cmd \Q$file\E |")
+	    or die "($prefix) Could not execute '$cmd'";
+	while(<F>) {
+		my $address = $_;
+		$address =~ s/^\s*//g;
+		$address =~ s/\n$//g;
+		$address = sanitize_address($address);
+		next if ($address eq $sanitized_sender and $suppress_from);
+		push @addresses, $address;
+		printf("($prefix) Adding %s: %s from: '%s'\n",
+		       $what, $address, $cmd) unless $quiet;
+		}
+	close F
+	    or die "($prefix) failed to close pipe to '$cmd'";
+	return @addresses;
+}
+
 cleanup_compose_files();
 
 sub cleanup_compose_files() {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 71b3df9..36cf421 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -201,6 +201,24 @@ test_expect_success $PREREQ 'Prompting works' '
 		grep "^To: to@example.com\$" msgtxt1
 '
 
+test_expect_success $PREREQ 'tocmd works' '
+	clean_fake_sendmail &&
+	cp $patches tocmd.patch &&
+	echo tocmd--tocmd@example.com >>tocmd.patch &&
+	{
+	  echo "#!$SHELL_PATH"
+	  echo sed -n -e s/^tocmd--//p \"\$1\"
+	} > tocmd-sed &&
+	chmod +x tocmd-sed &&
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--to-cmd=./tocmd-sed \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		tocmd.patch \
+		&&
+	grep "^To: tocmd@example.com" msgtxt1
+'
+
 test_expect_success $PREREQ 'cccmd works' '
 	clean_fake_sendmail &&
 	cp $patches cccmd.patch &&

^ permalink raw reply related	[relevance 60%]

* Re: bug (?) in send email
  @ 2012-07-30 12:30 60%   ` Thomas Rast
  0 siblings, 0 replies; 200+ results
From: Thomas Rast @ 2012-07-30 12:30 UTC (permalink / raw)
  To: Christoph Miebach; +Cc: git, Jürgen Rühle, Jeff King, Junio C Hamano

[+Cc people involved with this function]

Christoph Miebach <christoph.miebach@web.de> writes:

> > git commit --author="Michał Tz <name_1911@some.com>" modified.file -m
> > "Test"
> >
> > git format-patch -o patches origin
> >
> > Now, the patch seems to have the address right, see [1]
> >
> > git send-email  --to MYOWN.ADDRESS@mail.com --suppress-cc=author
> > patches/0001-Test.patch
> >
> > But checking my inbox now shows an email starting with:
> > From: Michał Tz <name 1911@some.com>
> 
> Removing this line
> s/_/ /g;
> here
> https://github.com/git/git/blob/master/git-send-email.perl#L867
>
> Solves this problem for me. But I really don't have any clue, what
> kind of side effects this modification on "sub unquote_rfc2047" might
> have.

It would prevent spaces from being decoded correctly if the encoding
program chooses to make the '_'.  git-format-patch does not actually do
this, see the big comment around pretty.c:304.

I think this patch would be a better match for what RFC2047 specifies.
On the one hand it avoids substituting _ outside of encodings, but OTOH
it also handles more than one encoded-word.  It still does not handle
the case where there are several encoded-words of *different* encodings,
but who would do such a crazy thing?


diff --git i/git-send-email.perl w/git-send-email.perl
index ef30c55..88c4758 100755
--- i/git-send-email.perl
+++ w/git-send-email.perl
@@ -862,11 +862,13 @@ sub make_message_id {
 sub unquote_rfc2047 {
 	local ($_) = @_;
 	my $encoding;
-	if (s/=\?([^?]+)\?q\?(.*)\?=/$2/g) {
+	s{=\?([^?]+)\?q\?(.*)\?=}{
 		$encoding = $1;
-		s/_/ /g;
-		s/=([0-9A-F]{2})/chr(hex($1))/eg;
-	}
+		my $e = $2;
+		$e =~ s/_/ /g;
+		$e =~ s/=([0-9A-F]{2})/chr(hex($1))/eg;
+		$e;
+	}eg;
 	return wantarray ? ($_, $encoding) : $_;
 }
 


-- 
Thomas Rast
trast@{inf,student}.ethz.ch

^ permalink raw reply related	[relevance 60%]

* Re: [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters
  @ 2008-03-26  8:39 60%         ` Jeff King
  0 siblings, 0 replies; 200+ results
From: Jeff King @ 2008-03-26  8:39 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: Junio C Hamano, git

On Wed, Mar 26, 2008 at 10:30:33AM +0200, Teemu Likonen wrote:

> I had missed the --cover-letter option completely. It may be useful too.
> I'm still trying to find the best way to send pathces. If I send intro
> message with real MUA I either need to wait for the message to show up
> on a mailing list or check my sent-mail folder to find the Message-Id.
> Once I know the Message-Id I can send the actual patch series with 'git
> send-email' as replies to the intro message. Well, this is OK.

That is how I used to do it; now I use --cover-letter (which you
probably missed because it is brand new in the upcoming 1.5.5).

> > I think that is sensible. Want to try adding it on top of my patches?
> I'd like to, but I can only do sh/bash stuff and possibly some
> copy-and-paste programming with other scripting languages. You'd end up
> fixing my code anyway, sorry.

OK, I will add it to the end of my long todo. Out of curiosity, do you
actually want something besides utf-8, or is this just to make us feel
feature complete?

> As you noticed, I accidentally sent you a couple of test emails because
> send-email CCed mails to patches' author (I think). Now I have set
> "suppresscc = all" and "suppressfrom = true" which should prevent such
> accidents. Shouldn't these be defaults? In my opinion it's generally the
> best practice to always explicitly define what parties emails are sent
> to.

I think this is probably a good change. But it is a behavior change,
which means it is definitely out during the -rc freeze. And it may or
may not need a warning period for users.

> There is unmatching bracket in your patch:

Argh, yes. I _thought_ I ran it successfully through the test script,
but obviously I failed to 'make' and just tested the previous version.
It works fine with the bracket removed.

For reference, the fixed-up patch is below.

-- >8 --
send-email: rfc2047-quote subject lines with non-ascii characters

We always use 'utf-8' as the encoding, since we currently
have no way of getting the information from the user.

This also refactors the quoting of recipient names, since
both processes can share the rfc2047 quoting code.

Signed-off-by: Jeff King <peff@peff.net>
---
 git-send-email.perl   |   19 +++++++++++++++++--
 t/t9001-send-email.sh |   15 +++++++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 7c4f06c..d0f9d4a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -536,6 +536,14 @@ EOT
 		if (!$in_body && /^MIME-Version:/i) {
 			$need_8bit_cte = 0;
 		}
+		if (!$in_body && /^Subject: ?(.*)/i) {
+			my $subject = $1;
+			$_ = "Subject: " .
+				($subject =~ /[^[:ascii:]]/ ?
+				 quote_rfc2047($subject) :
+				 $subject) .
+				"\n";
+		}
 		print C2 $_;
 	}
 	close(C);
@@ -626,6 +634,14 @@ sub unquote_rfc2047 {
 	return wantarray ? ($_, $encoding) : $_;
 }
 
+sub quote_rfc2047 {
+	local $_ = shift;
+	my $encoding = shift || 'utf-8';
+	s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
+	s/(.*)/=\?$encoding\?q\?$1\?=/;
+	return $_;
+}
+
 # use the simplest quoting being able to handle the recipient
 sub sanitize_address
 {
@@ -643,8 +659,7 @@ sub sanitize_address
 
 	# rfc2047 is needed if a non-ascii char is included
 	if ($recipient_name =~ /[^[:ascii:]]/) {
-		$recipient_name =~ s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
-		$recipient_name =~ s/(.*)/=\?utf-8\?q\?$1\?=/;
+		$recipient_name = quote_rfc2047($recipient_name);
 	}
 
 	# double quotes are needed if specials or CTLs are included
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e222c49..a4bcd28 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -210,4 +210,19 @@ test_expect_success '--compose respects user mime type' '
 	! grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
 '
 
+test_expect_success '--compose adds MIME for utf8 subject' '
+	clean_fake_sendmail &&
+	echo y | \
+	  GIT_EDITOR=$(pwd)/fake-editor \
+	  GIT_SEND_EMAIL_NOTTY=1 \
+	  git send-email \
+	  --compose --subject utf8-sübjëct \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^fake edit" msgtxt1 &&
+	grep "^Subject: =?utf-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
+'
+
 test_done
-- 
1.5.5.rc1.133.g360d

^ permalink raw reply related	[relevance 60%]

* [PATCH] allow 8bit data in email body sent by send-email
@ 2009-01-08 13:50 60% Andre Przywara
  0 siblings, 0 replies; 200+ results
From: Andre Przywara @ 2009-01-08 13:50 UTC (permalink / raw)
  To: git; +Cc: Andre Przywara

Hi,
when sending patch files via git send-email, the perl script assumes
7bit characters only. If there are other bytes in the body (foreign language
characters in names or translations), some servers (like vger.kernel.org)
reject the mail because of thät. This patch always adds an 8bit header line
to each mail.
If someone thinks this has any side-effects, tell me, I am open to suggestions.

Regards,
André.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>

Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 277-84917
****to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Jochen Polster; Thomas M. McCoy; Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

---
 git-send-email.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 77ca8fe..68a462c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -793,6 +793,7 @@ To: $to${ccline}
 Subject: $subject
 Date: $date
 Message-Id: $message_id
+Content-Transfer-Encoding: 8bit
 X-Mailer: git-send-email $gitversion
 ";
 	if ($thread && $reply_to) {
-- 
1.5.5

^ permalink raw reply related	[relevance 60%]

* Re: [PATCH 2/2] git-send-email: use locale encoding for compose
  @ 2012-10-09 23:02 60%     ` Krzysztof Mazur
  0 siblings, 0 replies; 200+ results
From: Krzysztof Mazur @ 2012-10-09 23:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Tue, Oct 09, 2012 at 02:34:59PM -0700, Junio C Hamano wrote:
> Krzysztof Mazur <krzysiek@podlesie.net> writes:
> 
> > The introduction email (--compose option) use UTF-8 as default encoding.
> > The current locale encoding is much better default value.
> >
> 
> These two patches make sense in general, but t9001.62 (--compose
> adds MIME for utf8 body) seems to be broken by it.  I didn't check
> to see if the code is broken, or the test has expecting a wrong
> behaviour.  If the latter, the test needs to be updated to match the
> improved new world order.
> 
> Thanks.

The second patch was broken - for C locale the ANSI_X3.4-1968 codeset
was used, which is insane because git-send-email adds Content-Type
only when non-ASCII characters were found. I think this can be fixed
by just using UTF-8 if langinfo returns ANSI_X3.4-1968.

However I think that that patch should be dropped for now, because also
other git commands like "git commit" don't use codeset from locale.
The git commit just detects invalid UTF-8 characters and prints hint
for user to set i18n.commitencoding. If you like the idea of using codeset
from locale I can send fixed patch and also change "git commit".

For now I think it's better to just take only the first patch.

I'm resending the first patch with added tests.

Thanks,
Chris
--- 
From 0d1fccc5e70367f3eeb2372b8fc24401bf88d748 Mon Sep 17 00:00:00 2001
From: Krzysztof Mazur <krzysiek@podlesie.net>
Date: Wed, 10 Oct 2012 00:17:29 +0200
Subject: [PATCH] git-send-email: introduce compose-encoding

The introduction email (--compose option) have encoding hardcoded to
UTF-8, but invoked editor may not use UTF-8 encoding.
The encoding used by patches can be changed by the "8bit-encoding"
option, but this option does not have effect on introduction email
and equivalent for introduction email is missing.

Added compose-encoding command line option and sendemail.composeencoding
configuration option specify encoding of introduction email.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
---
 Documentation/git-send-email.txt |  5 ++++
 git-send-email.perl              |  9 ++++++-
 t/t9001-send-email.sh            | 55 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3241170..9f09e92 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -126,6 +126,11 @@ The --to option must be repeated for each user you want on the to list.
 +
 Note that no attempts whatsoever are made to validate the encoding.
 
+--compose-encoding=<encoding>::
+	Specify encoding of compose message. Default is the value of the
+	'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
++
+
 
 Sending
 ~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index aea66a0..107e814 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -56,6 +56,7 @@ git send-email [options] <file | directory | rev-list options >
     --in-reply-to           <str>  * Email "In-Reply-To:"
     --annotate                     * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
+    --compose-encoding      <str>  * Encoding to assume for introduction.
     --8bit-encoding         <str>  * Encoding to assume 8bit mails if undeclared
 
   Sending:
@@ -198,6 +199,7 @@ my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
 my ($validate, $confirm);
 my (@suppress_cc);
 my ($auto_8bit_encoding);
+my ($compose_encoding);
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -231,6 +233,7 @@ my %config_settings = (
     "confirm"   => \$confirm,
     "from" => \$sender,
     "assume8bitencoding" => \$auto_8bit_encoding,
+    "composeencoding" => \$compose_encoding,
 );
 
 my %config_path_settings = (
@@ -315,6 +318,7 @@ my $rc = GetOptions("h" => \$help,
 		    "validate!" => \$validate,
 		    "format-patch!" => \$format_patch,
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
+		    "compose-encoding=s" => \$compose_encoding,
 		    "force" => \$force,
 	 );
 
@@ -638,10 +642,13 @@ EOT
 			$summary_empty = 0 unless (/^\n$/);
 		} elsif (/^\n$/) {
 			$in_body = 1;
+			if (!defined $compose_encoding) {
+				$compose_encoding = "UTF-8";
+			}
 			if ($need_8bit_cte) {
 				print $c2 "MIME-Version: 1.0\n",
 					 "Content-Type: text/plain; ",
-					   "charset=UTF-8\n",
+					   "charset=$compose_encoding\n",
 					 "Content-Transfer-Encoding: 8bit\n";
 			}
 		} elsif (/^MIME-Version:/i) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 0351228..265ae04 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -854,6 +854,61 @@ test_expect_success $PREREQ 'utf8 author is correctly passed on' '
 	grep "^From: Fßùný NâmÊ <odd_?=mail@example.com>" msgtxt1
 '
 
+test_expect_success $PREREQ 'sendemail.composeencoding works' '
+	clean_fake_sendmail &&
+	git config sendemail.composeencoding iso-8859-1 &&
+	(echo "#!$SHELL_PATH" &&
+	 echo "echo utf8 body: àÊÏÜú >>\"\$1\""
+	) >fake-editor-utf8 &&
+	chmod +x fake-editor-utf8 &&
+	  GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
+	  git send-email \
+	  --compose --subject foo \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^utf8 body" msgtxt1 &&
+	grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
+'
+
+test_expect_success $PREREQ '--compose-encoding works' '
+	clean_fake_sendmail &&
+	(echo "#!$SHELL_PATH" &&
+	 echo "echo utf8 body: àÊÏÜú >>\"\$1\""
+	) >fake-editor-utf8 &&
+	chmod +x fake-editor-utf8 &&
+	  GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
+	  git send-email \
+	  --compose-encoding iso-8859-1 \
+	  --compose --subject foo \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^utf8 body" msgtxt1 &&
+	grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
+'
+
+test_expect_success $PREREQ '--compose-encoding overrides sendemail.composeencoding' '
+	clean_fake_sendmail &&
+	git config sendemail.composeencoding iso-8859-1 &&
+	(echo "#!$SHELL_PATH" &&
+	 echo "echo utf8 body: àÊÏÜú >>\"\$1\""
+	) >fake-editor-utf8 &&
+	chmod +x fake-editor-utf8 &&
+	  GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
+	  git send-email \
+	  --compose-encoding iso-8859-2 \
+	  --compose --subject foo \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^utf8 body" msgtxt1 &&
+	grep "^Content-Type: text/plain; charset=iso-8859-2" msgtxt1
+'
+
 test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '
 	echo master > master &&
 	git add master &&
-- 
1.7.12.2.2.g1c3c581

^ permalink raw reply related	[relevance 60%]

* [PATCH 13/16] send-email: extract_valid_address use qr// regexes and /o
                     ` (12 preceding siblings ...)
  2010-09-30 13:43 61% ` [PATCH 15/16] send-email: make_message_id use "require" instead of "use" Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:43 60% ` Ævar Arnfjörð Bjarmason
  2010-09-30 19:03 62%   ` [PATCH v2 13/16] send-email: extract_valid_address use qr// regexes Ævar Arnfjörð Bjarmason
  2010-09-30 13:42 58% ` [PATCH 03/16] send-email: use lexical filehandles during sending Ævar Arnfjörð Bjarmason
  2010-09-30 13:42 57% ` [PATCH 02/16] send-email: use lexical filehandles for $compose Ævar Arnfjörð Bjarmason
  15 siblings, 1 reply; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:43 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Change the regex fragment in extract_valid_address to use the qr//
syntax for compiled regexes, and when they're used add a /o flag so
they're only compiled once for the lifetime of the program.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-send-email.perl |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index b87c3f2..47d86ad 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -777,11 +777,11 @@ our ($message_id, %mail, $subject, $reply_to, $references, $message,
 
 sub extract_valid_address {
 	my $address = shift;
-	my $local_part_regexp = '[^<>"\s@]+';
-	my $domain_regexp = '[^.<>"\s@]+(?:\.[^.<>"\s@]+)+';
+	my $local_part_regexp = qr/[^<>"\s@]+/;
+	my $domain_regexp = qr/[^.<>"\s@]+(?:\.[^.<>"\s@]+)+/;
 
 	# check for a local address:
-	return $address if ($address =~ /^($local_part_regexp)$/);
+	return $address if ($address =~ /^($local_part_regexp)$/o);
 
 	$address =~ s/^\s*<(.*)>\s*$/$1/;
 	if ($have_email_valid) {
@@ -789,7 +789,7 @@ sub extract_valid_address {
 	} else {
 		# less robust/correct than the monster regexp in Email::Valid,
 		# but still does a 99% job, and one less dependency
-		$address =~ /($local_part_regexp\@$domain_regexp)/;
+		$address =~ /($local_part_regexp\@$domain_regexp)/o;
 		return $1;
 	}
 }
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 60%]

* [RFC+PATCH 1/1] Move SCM interoperability tools into scm/
@ 2006-07-09  6:17 60% Ryan Anderson
  0 siblings, 0 replies; 200+ results
From: Ryan Anderson @ 2006-07-09  6:17 UTC (permalink / raw)
  To: git; +Cc: Ryan Anderson

Signed-off-by: Ryan Anderson <ryan@michonline.com>
---

This is the first in a series to categorize the source tree a little bit more
than it is currently.

I figured I'd start with something innocuous, like the SCM interoperability
tools.

One thing I don't really like is that I had to duplicate the Perl build rule
in the subdirectory Makefile, effectively, to restructure it and leave the
built files in the root.  If we can deprecate "run from the source tree",
this can go away.  (That requires fixing up a lot of tests, but it's
straightforward, at least.)

So, flame away!


 Makefile                                           |   10 ++++++----
 scm/Makefile                                       |   20 ++++++++++++++++++++
 git-archimport.perl => scm/git-archimport.perl     |    0 
 .../git-cvsexportcommit.perl                       |    0 
 git-cvsimport.perl => scm/git-cvsimport.perl       |    0 
 git-cvsserver.perl => scm/git-cvsserver.perl       |    0 
 git-p4import.py => scm/git-p4import.py             |    0 
 git-send-email.perl => scm/git-send-email.perl     |    0 
 git-svnimport.perl => scm/git-svnimport.perl       |    0 
 9 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 202f261..e7f5b48 100644
--- a/Makefile
+++ b/Makefile
@@ -130,11 +130,10 @@ SCRIPT_SH = \
 	git-lost-found.sh git-quiltimport.sh
 
 SCRIPT_PERL = \
-	git-archimport.perl git-cvsimport.perl git-relink.perl \
+	git-relink.perl \
 	git-shortlog.perl git-rerere.perl \
-	git-annotate.perl git-cvsserver.perl \
-	git-svnimport.perl git-mv.perl git-cvsexportcommit.perl \
-	git-send-email.perl
+	git-annotate.perl \
+	git-mv.perl
 
 SCRIPT_PYTHON = \
 	git-merge-recursive.py
@@ -176,6 +175,9 @@ BUILT_INS = git-log$X git-whatchanged$X 
 	git-diff-index$X git-diff-stages$X git-diff-tree$X git-cat-file$X \
 	git-fmt-merge-msg$X
 
+
+include scm/Makefile
+
 # what 'all' will build and 'install' will install, in gitexecdir
 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
 
diff --git a/scm/Makefile b/scm/Makefile
new file mode 100644
index 0000000..0ce205b
--- /dev/null
+++ b/scm/Makefile
@@ -0,0 +1,20 @@
+
+SCM_PERL_BASE = \
+	git-archimport.perl \
+	git-cvsimport.perl \
+	git-cvsexportcommit.perl \
+	git-cvsserver.perl \
+	git-svnimport.perl \
+	git-send-email.perl
+
+SCRIPTS+=$(patsubst %.perl,%,$(SCM_PERL_BASE))
+
+$(patsubst %.perl,%,$(SCM_PERL_BASE)) : % : scm/%.perl
+	rm -f $@ $@+
+	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+	    $^ >$@+
+	chmod +x $@+
+	mv $@+ $@
+
+
diff --git a/git-archimport.perl b/scm/git-archimport.perl
similarity index 100%
rename from git-archimport.perl
rename to scm/git-archimport.perl
diff --git a/git-cvsexportcommit.perl b/scm/git-cvsexportcommit.perl
similarity index 100%
rename from git-cvsexportcommit.perl
rename to scm/git-cvsexportcommit.perl
diff --git a/git-cvsimport.perl b/scm/git-cvsimport.perl
similarity index 100%
rename from git-cvsimport.perl
rename to scm/git-cvsimport.perl
diff --git a/git-cvsserver.perl b/scm/git-cvsserver.perl
similarity index 100%
rename from git-cvsserver.perl
rename to scm/git-cvsserver.perl
diff --git a/git-p4import.py b/scm/git-p4import.py
similarity index 100%
rename from git-p4import.py
rename to scm/git-p4import.py
diff --git a/git-send-email.perl b/scm/git-send-email.perl
similarity index 100%
rename from git-send-email.perl
rename to scm/git-send-email.perl
diff --git a/git-svnimport.perl b/scm/git-svnimport.perl
similarity index 100%
rename from git-svnimport.perl
rename to scm/git-svnimport.perl
-- 
1.4.1.gc473b-dirty

^ permalink raw reply related	[relevance 60%]

* [PATCH] git-send-email: Accept -n as a synonym for --dry-run
@ 2010-12-09  4:44 60% Alejandro R. Sedeño
  2010-12-10 18:44 63% ` [PATCH 2/2] git-send-email: Add some short options Alejandro R. Sedeño
  0 siblings, 1 reply; 200+ results
From: Alejandro R. Sedeño @ 2010-12-09  4:44 UTC (permalink / raw)
  To: git

git-send-email is not currently using -n for anything else, and it
seems unlikely we will want to use it to mean anything else in the
future, so add it as an alias for convenience.

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
---
 git-send-email.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 76565de..7e3df9a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -85,7 +85,7 @@ git send-email [options] <file | directory | rev-list options >
     --confirm               <str>  * Confirm recipients before sending;
                                      auto, cc, compose, always, or never.
     --quiet                        * Output one line of info per email.
-    --dry-run                      * Don't actually send the emails.
+    -n, --dry-run                  * Don't actually send the emails.
     --[no-]validate                * Perform patch sanity checks. Default on.
     --[no-]format-patch            * understand any non optional arguments as
                                      `git format-patch` ones.
@@ -304,7 +304,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "suppress-cc=s" => \@suppress_cc,
 		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
 		    "confirm=s" => \$confirm,
-		    "dry-run" => \$dry_run,
+		    "dry-run|n" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
 		    "validate!" => \$validate,
-- 
1.7.3.3

^ permalink raw reply related	[relevance 60%]

* [PATCH v2 2/2] send-email: honor transferencoding config option again
  @ 2019-05-08 10:56 60% ` Junio C Hamano
  2019-05-08 10:56 56% ` [PATCH v2 1/2] send-email: update the mechanism to set default configuration values Junio C Hamano
  1 sibling, 0 replies; 200+ results
From: Junio C Hamano @ 2019-05-08 10:56 UTC (permalink / raw)
  To: git; +Cc: Heinrich Schuchardt, Brian M Carlson, Jonathan Nieder

Since e67a228cd8a ("send-email: automatically determine
transfer-encoding"), the value of sendmail.transferencoding in the
configuration file is ignored, because $target_xfer_encoding is
already defined read_config sub parses the configuration file.

Instead of initializing variable $target_xfer_encoding to 'auto' on
definition, we have to set it to the default value of 'auto' if is
undefined after calling read_config() twice to parsing the
configuration files for "sendemail.transferencoding" and
"sendemail.$ident.transferencoding".

It was made trivial to do so by the previous change.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-send-email.perl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 98bc295c6e..b9dd775b63 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -231,7 +231,7 @@ sub do_edit {
 my (@suppress_cc);
 my ($auto_8bit_encoding);
 my ($compose_encoding);
-my $target_xfer_encoding = 'auto';
+my ($target_xfer_encoding);
 
 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()
 
@@ -271,7 +271,7 @@ sub do_edit {
     "from" => [\$sender],
     "assume8bitencoding" => [\$auto_8bit_encoding],
     "composeencoding" => [\$compose_encoding],
-    "transferencoding" => [\$target_xfer_encoding],
+    "transferencoding" => [\$target_xfer_encoding, 'auto'],
 );
 
 my %config_path_settings = (
-- 
2.21.0-777-g83232e3864


^ permalink raw reply related	[relevance 60%]

* [PATCH 1/2] perl libs: perl -w + use warnings is redundant
  2010-05-21 14:50 63% [PATCH] perl libs: perl -w + use warnings is redundant Ævar Arnfjörð Bjarmason
@ 2010-05-21 16:52 60% ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-05-21 16:52 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason

Change the Perl scripts to turn on lexical warnings, but only in Perl
scripts that definitely require 5.6.0 or later. I.e. those that either
did 'use warnings' in addition to -w already, or used the three-arg
form of open.

-w sets warnings for all code that interpreter runs. "use warnings" is
lexically scoped. The former is probably not what the authors wanted.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

Turns out that I missed a case or two that could 'use
warnings'. I.e. used three-arg open.

 Documentation/cat-texi.perl                 |    3 ++-
 Documentation/cmd-list.perl                 |    4 ++--
 contrib/examples/git-remote.perl            |    3 ++-
 contrib/examples/git-svnimport.perl         |    2 +-
 contrib/fast-import/import-directories.perl |    3 ++-
 contrib/stats/mailmap.pl                    |    3 ++-
 git-add--interactive.perl                   |    3 ++-
 git-archimport.perl                         |    2 +-
 git-cvsimport.perl                          |    2 +-
 git-send-email.perl                         |    2 +-
 10 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/Documentation/cat-texi.perl b/Documentation/cat-texi.perl
index 828ec62..082978f 100755
--- a/Documentation/cat-texi.perl
+++ b/Documentation/cat-texi.perl
@@ -1,4 +1,5 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
+use warnings;
 
 my @menu = ();
 my $output = $ARGV[0];
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 04f9977..07d526e 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
-
+#!/usr/bin/perl
+use warnings;
 use File::Compare qw(compare);
 
 sub format_one {
diff --git a/contrib/examples/git-remote.perl b/contrib/examples/git-remote.perl
index b17952a..48ab0ef 100755
--- a/contrib/examples/git-remote.perl
+++ b/contrib/examples/git-remote.perl
@@ -1,6 +1,7 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 use strict;
+use warnings;
 use Git;
 my $git = Git->repository();
 
diff --git a/contrib/examples/git-svnimport.perl b/contrib/examples/git-svnimport.perl
index 4576c4a..ead4c04 100755
--- a/contrib/examples/git-svnimport.perl
+++ b/contrib/examples/git-svnimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 # This tool is copyright (c) 2005, Matthias Urlichs.
 # It is released under the Gnu Public License, version 2.
diff --git a/contrib/fast-import/import-directories.perl b/contrib/fast-import/import-directories.perl
index 3a5da4a..7f3afa5 100755
--- a/contrib/fast-import/import-directories.perl
+++ b/contrib/fast-import/import-directories.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # Copyright 2008-2009 Peter Krefting <peter@softwolves.pp.se>
 #
@@ -140,6 +140,7 @@ by whitespace or other characters.
 
 # Globals
 use strict;
+use warnings;
 use integer;
 my $crlfmode = 0;
 my @revs;
diff --git a/contrib/stats/mailmap.pl b/contrib/stats/mailmap.pl
index 4b852e2..ff296fa 100755
--- a/contrib/stats/mailmap.pl
+++ b/contrib/stats/mailmap.pl
@@ -1,4 +1,5 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
+use warnings;
 my %mailmap = ();
 open I, "<", ".mailmap";
 while (<I>) {
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 21f1330..c2e7ab4 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1,6 +1,7 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 use strict;
+use warnings;
 use Git;
 
 binmode(STDOUT, ":raw");
diff --git a/git-archimport.perl b/git-archimport.perl
index 98f3ede..6ee3fca 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # This tool is copyright (c) 2005, Martin Langhoff.
 # It is released under the Gnu Public License, version 2.
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 9e03eee..d5e5677 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 # This tool is copyright (c) 2005, Matthias Urlichs.
 # It is released under the Gnu Public License, version 2.
diff --git a/git-send-email.perl b/git-send-email.perl
index 111c981..bbb03f7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # Copyright 2002,2005 Greg Kroah-Hartman <greg@kroah.com>
 # Copyright 2005 Ryan Anderson <ryan@michonline.com>
-- 
1.7.1.98.g4a5f

^ permalink raw reply related	[relevance 60%]

* [PATCH] send-email: use catfile() to concatenate files
@ 2010-09-14 19:02 60% Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-14 19:02 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason

Change send-email to use Perl's catfile() function instead of
"$dir/$file". If send-email is given a $dir that ends with a / we'll
end up printing a double slashed path like "dir//mtfnpy.patch".

This doesn't cause any problems since Perl's IO layer will handle it,
but it looks ugly.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-send-email.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 6dab3bf..7f702e3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -24,6 +24,7 @@ use Text::ParseWords;
 use Data::Dumper;
 use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
+use File::Spec::Functions qw(catfile);
 use Error qw(:try);
 use Git;
 
@@ -511,7 +512,7 @@ while (defined(my $f = shift @ARGV)) {
 		opendir(DH,$f)
 			or die "Failed to opendir $f: $!";
 
-		push @files, grep { -f $_ } map { +$f . "/" . $_ }
+		push @files, grep { -f $_ } map { catfile($f, $_) }
 				sort readdir(DH);
 		closedir(DH);
 	} elsif ((-f $f or -p $f) and !check_file_rev_conflict($f)) {
-- 
1.7.3.rc1.234.g8dc15

^ permalink raw reply related	[relevance 60%]

* Re: git-send-email: smtpserver in $HOME
  2021-02-16  2:14 62% ` Junio C Hamano
@ 2021-02-16 12:49 60%   ` Jan “Khardix” Staněk
  0 siblings, 0 replies; 200+ results
From: Jan “Khardix” Staněk @ 2021-02-16 12:49 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 1897 bytes --]

On 2021-02-15, Junio C Hamano wrote:
> I haven't given too much thought, but offhand do not think of a
> reason why a change like the attached would break things.

Seems reasonable, but I figured I rather ask beforehand.

>  git-send-email.perl | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git c/git-send-email.perl w/git-send-email.perl
> index 1f425c0809..ff58ac5046 100755
> --- c/git-send-email.perl
> +++ w/git-send-email.perl
> @@ -1006,6 +1006,8 @@ sub expand_one_alias {
>  		}
>  	}
>  	$smtp_server ||= 'localhost'; # could be 127.0.0.1, too... *shrug*
> +} elsif ($smtp_server =~ /^~/) {
> +	$smtp_server = glob($smtp_server);
>  }

This introduces a special case just for handling $smtp_server…
I was thinking something in the way of the following:

diff --git a/git-send-email.perl b/git-send-email.perl
index 1f425c0809..84c07daf6d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -268,7 +268,6 @@ sub do_edit {
 );

 my %config_settings = (
-    "smtpserver" => \$smtp_server,
     "smtpserverport" => \$smtp_server_port,
     "smtpserveroption" => \@smtp_server_options,
     "smtpuser" => \$smtp_authuser,
@@ -294,6 +293,7 @@ sub do_edit {

 my %config_path_settings = (
     "aliasesfile" => \@alias_files,
+    "smtpserver" => \$smtp_server,
     "smtpsslcertpath" => \$smtp_ssl_cert_path,
 );

This turns the smtpserver option into a "path setting",
which does the user expansion.
My concern was that if there is a SMTP server actually named
i.e. `~someone.example.org`, this change would break that.
Of course, the question is if something like that
is possible or supported…

I have not yet allocated enough time to figure out how to run
and/or modify the test suite, so I do not know if this would actually
break something. I will try to do that in the near future.
--
Jan Staněk – Khardix

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[relevance 60%]

* [PATCH] Fix bug when more than one readline instance is used
@ 2023-08-10  0:39 60% Wesley Schwengle
  0 siblings, 0 replies; 200+ results
From: Wesley Schwengle @ 2023-08-10  0:39 UTC (permalink / raw)
  To: git

The following error was emitted if one issued the command

    git send-email --compose 0001-my.patch

Can't locate object method "IN" via package "FakeTerm" at
/home/wesleys/libexec/git-core/git-send-email line 997.

After added a warn in the relevant function that created the term it was
obvious what happened:

Only one Term::ReadLine::Gnu instance is allowed. at
/home/wesleys/libexec/git-core/git-send-email line 981.

When you supply no --to send-email asks you to whom you want to send the
email to. This starts a term, the first Term::ReadLine::Gnu instance.
The second time it wants to ask the user 'Send this email?
([y]es|[n]o|[e]dit|[q]uit|[a]ll):' and this causes FakeTerm to be
loaded, but it doesn't have IN/OUT methods and thus fails.

The fix is to make $term global. If git chooses to drop perl 5.8 support
and allows Perl 5.10, we could also use the state feature. Which would
solve the problem without making $term global.

More or less the same logic happens in git-svn.perl so I fixed it there
as well.

Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
---
 git-send-email.perl | 4 +++-
 git-svn.perl        | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index affbb88509..7fdcf9084a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -971,8 +971,10 @@ sub get_patch_subject {
 	do_edit(@files);
 }
 
+my $term;
 sub term {
-	my $term = eval {
+	return $term if $term;
+	$term = eval {
 		require Term::ReadLine;
 		$ENV{"GIT_SEND_EMAIL_NOTTY"}
 			? Term::ReadLine->new('git-send-email', \*STDIN, \*STDOUT)
diff --git a/git-svn.perl b/git-svn.perl
index be987e316f..2813551e06 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -306,10 +306,12 @@ sub readline {
 	my $self = shift;
 	die "Cannot use readline on FakeTerm: $$self";
 }
+
 package main;
 
 my $term;
 sub term_init {
+	return $term if $term;
 	$term = eval {
 		require Term::ReadLine;
 		$ENV{"GIT_SVN_NOTTY"}
-- 
2.42.0.rc0.26.ga73c38ecaa


^ permalink raw reply related	[relevance 60%]

* [PATCH] git-send-email.perl extract_valid_address issue
@ 2006-05-29  4:00 61% Nicolas Troncoso Carrere
  0 siblings, 0 replies; 200+ results
From: Nicolas Troncoso Carrere @ 2006-05-29  4:00 UTC (permalink / raw)
  To: git


The third fallback was returning if the match was done or not instead of
returning the actual email address that was matched. This prevented sending
the mail to the people included in the CC. This bug only affect those that
dont have Email::Valid.

I initialized $valid_email as undef so it would mimic the behavior of 
Email::Verify->address(), which returns undef if no valid address was found.

Signed-off-by: Nicolas <ntroncos@inf.utfsm.cl>


---

 git-send-email.perl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

84853ca89c15de7a24e9eb9fd422654b86c63be9
diff --git a/git-send-email.perl b/git-send-email.perl
index 312a4ea..dfff3e6 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -316,7 +316,9 @@ sub extract_valid_address {
 	} else {
 		# less robust/correct than the monster regexp in Email::Valid,
 		# but still does a 99% job, and one less dependency
-		return ($address =~ /([^\"<>\s]+@[^<>\s]+)/);
+                my $valid_email=undef;
+                ($valid_email ) = ($address =~ /([^\"<>\s]+@[^<>\s]+)/);
+                return ($valid_email);
 	}
 }
-- 
Nicolás Troncoso Carrère                        User #272312 counter.li.org
Estudiante Magíster en Ciencias de la Informática
Universidad Técnica Federico Santa María
http://www.alumnos.inf.utfsm.cl/~ntroncos

^ permalink raw reply related	[relevance 61%]

* Re: How can I specify the "sendmail" program for git-send-email?
  @ 2012-06-11  9:15 61%     ` Erik Faye-Lund
  0 siblings, 0 replies; 200+ results
From: Erik Faye-Lund @ 2012-06-11  9:15 UTC (permalink / raw)
  To: Richard Yang; +Cc: git

On Mon, Jun 11, 2012 at 11:04 AM, Richard Yang
<weiyang@linux.vnet.ibm.com> wrote:
> On Mon, Jun 11, 2012 at 10:23:21AM +0200, Erik Faye-Lund wrote:
>>On Mon, Jun 11, 2012 at 9:32 AM, Richard Yang
>><weiyang@linux.vnet.ibm.com> wrote:
>>> Hi, experts
>>>
>>> I read the git-send-email manual and find the --smtp-server option can
>>> specify the sendmail-like program to send mail.
>>>
>>> Then I use this option in command line
>>> --smtp-server=/usr/bin/msmtp
>>> This works.
>>>
>>> While I found it not very convenient to write the option on command line
>>> every time, then I wrote it in the .gitconfig file in my home directory.
>>>
>>> [sendmail]
>>>        smtpserver = /usr/bin/msmtp
>>>        smtppass       = 123456
>>>        smtpuser       = weiyang@linux.vnet.ibm.com
>>>        smtpserverport = 143
>>
>>The configuration-section for git send-mail is actually spelled
>>"sendemail", and not "sendmail". Notice the additional 'e'.
> Oops, a stupid mistake.
>
> Thanks all :)

Well, I've always been slightly annoyed by the "send-mail" vs
"sendemail" inconsistency. Perhaps we could do something along these
lines (plus all documentation-updates, omitted for clarity) to reduce
the risk of confusion?

Yeah, the leaking of $identity between different sections is a bit
suboptimal, but as a fallback-mechanism I don't think it actually
matters much.

diff --git a/git-send-email.perl b/git-send-email.perl
index 03292fd..d167d96 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -375,7 +375,11 @@ sub read_config {
 	}
 }

-# read configuration from [sendemail "$identity"], fall back on [sendemail]
+# read configuration from [sendmail "$identity"], fall back on [sendmail]
+$identity = Git::config(@repo, "sendmail.identity") unless (defined $identity);
+read_config("sendmail.$identity") if (defined $identity);
+read_config("sendmail");
+# same as above, but with legacy "sendemail"
 $identity = Git::config(@repo, "sendemail.identity") unless (defined
$identity);
 read_config("sendemail.$identity") if (defined $identity);
 read_config("sendemail");

^ permalink raw reply related	[relevance 61%]

* [PATCH V3] git-send-email: Add auto-cc to all body signatures
  @ 2015-12-02 17:00 61%           ` Joe Perches
  0 siblings, 0 replies; 200+ results
From: Joe Perches @ 2015-12-02 17:00 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: Junio C Hamano, git, jeffrey.t.kirsher

Many types of signatures are used by various projects.

The most common type is formatted:
	"[some_signature_type]-by: First Last <email <at> domain.tld>"
e.g:
	"Reported-by: First Last <email <at> domain.tld>" (no quotes are used)

Make git-send-email use these signatures as "CC:" entries.

Add command line option --suppress-cc=signatures to avoid
adding these entries to the cc.

Signed-off-by: Joe Perches <joe <at> perches.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher <at> intel.com>
---
> It's been four years, but I recently ran into this. I mistakenly thought
> that git would actually pick up cc addresses also from Reported-by, so
> the reporter ended up not being cc'ed. Is there any chance this could be
> revisited,

Here's a refresh if desired.  I still think it's sensible.

 Documentation/git-send-email.txt |  3 ++-
 git-send-email.perl              | 11 ++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index b9134d2..0866ae2 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -306,8 +306,9 @@ Automating
   patch body (commit message) except for self (use 'self' for that).
 - 'sob' will avoid including anyone mentioned in Signed-off-by lines except
    for self (use 'self' for that).
+- 'signatures' will avoid including anyone mentioned in any "<foo>-by:" lines.
 - 'cccmd' will avoid running the --cc-cmd.
-- 'body' is equivalent to 'sob' + 'bodycc'
+- 'body' is equivalent to 'sob' + 'bodycc' + 'signatures'
 - 'all' will suppress all auto cc values.
 --
 +
diff --git a/git-send-email.perl b/git-send-email.perl
index e907e0ea..536e264 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -83,7 +83,7 @@ git send-email [options] <file | directory | rev-list options >
     --identity              <str>  * Use the sendemail.<id> options.
     --to-cmd                <str>  * Email To: via `<str> \$patch_path`
     --cc-cmd                <str>  * Email Cc: via `<str> \$patch_path`
-    --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, bodycc, all.
+    --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, bodycc, signatures, all.
     --[no-]cc-cover                * Email Cc: addresses in the cover letter.
     --[no-]to-cover                * Email To: addresses in the cover letter.
     --[no-]signed-off-by-cc        * Send to Signed-off-by: addresses. Default on.
@@ -421,13 +421,13 @@ my(%suppress_cc);
 if (@suppress_cc) {
 	foreach my $entry (@suppress_cc) {
 		die "Unknown --suppress-cc field: '$entry'\n"
-			unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc)$/;
+			unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc|signatures)$/;
 		$suppress_cc{$entry} = 1;
 	}
 }
 
 if ($suppress_cc{'all'}) {
-	foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
+	foreach my $entry (qw (cccmd cc author self sob body bodycc signatures)) {
 		$suppress_cc{$entry} = 1;
 	}
 	delete $suppress_cc{'all'};
@@ -438,7 +438,7 @@ $suppress_cc{'self'} = $suppress_from if defined $suppress_from;
 $suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc;
 
 if ($suppress_cc{'body'}) {
-	foreach my $entry (qw (sob bodycc)) {
+	foreach my $entry (qw (sob bodycc signatures)) {
 		$suppress_cc{$entry} = 1;
 	}
 	delete $suppress_cc{'body'};
@@ -1516,7 +1516,7 @@ foreach my $t (@files) {
 	# Now parse the message body
 	while(<$fh>) {
 		$message .=  $_;
-		if (/^(Signed-off-by|Cc): (.*)$/i) {
+		if (/^(Signed-off-by|Cc|[^\s]+[_-]by): (.*)$/i) {
 			chomp;
 			my ($what, $c) = ($1, $2);
 			chomp $c;
@@ -1526,6 +1526,7 @@ foreach my $t (@files) {
 			} else {
 				next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
 				next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
+				next if $suppress_cc{'signatures'} and $what =~ /by$/i;
 			}
 			push @cc, $c;
 			printf("(body) Adding cc: %s from line '%s'\n",

^ permalink raw reply related	[relevance 61%]

* [PATCH] send-email: don't add sender to Cc: if --suppress-from is given.
@ 2007-08-07 13:12 61% Uwe Kleine-König
  0 siblings, 0 replies; 200+ results
From: Uwe Kleine-König @ 2007-08-07 13:12 UTC (permalink / raw)
  To: Git Mailing List

Up to now the sender is added to the Cc: list for Signed-off-by and Cc
lines even if --suppress-from is requested.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
---
Hello,

Maybe the address should be added for a Cc: line, but not for
Signed-off-by?

Best regards
Uwe

 git-send-email.perl |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 39e433b..9d7f6a8 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -646,9 +646,11 @@ foreach my $t (@files) {
 			if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {
 				my $c = $2;
 				chomp $c;
-				push @cc, $c;
-				printf("(sob) Adding cc: %s from line '%s'\n",
-					$c, $_) unless $quiet;
+				if (not $suppress_from or unquote_rfc2047($c) eq $from) {
+					push @cc, $c;
+					printf("(sob) Adding cc: %s from line '%s'\n",
+						$c, $_) unless $quiet;
+				}
 			}
 		}
 	}
-- 
1.5.3.rc3.13.g7ab3

^ permalink raw reply related	[relevance 61%]

* [PATCH 15/16] send-email: make_message_id use "require" instead of "use"
                     ` (11 preceding siblings ...)
  2010-09-30 13:43 61% ` [PATCH 08/16] send-email: use \E***\Q instead of \*\*\* Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:43 61% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:43 60% ` [PATCH 13/16] send-email: extract_valid_address use qr// regexes and /o Ævar Arnfjörð Bjarmason
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:43 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Change the use of Sys::Hostname from a "use" to a "require". The
former happens in an implicit BEGIN block and is thus immune from the
if block it's contained in, so it's always loaded.

This should speed up the invocation of git-send-email by a few
milliseconds.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 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 9cb6aa6..5a19d3d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -819,7 +819,7 @@ sub make_message_id {
 		last if (defined $du_part and $du_part ne '');
 	}
 	if (not defined $du_part or $du_part eq '') {
-		use Sys::Hostname qw();
+		require Sys::Hostname;
 		$du_part = 'user@' . Sys::Hostname::hostname();
 	}
 	my $message_id_template = "<%s-git-send-email-%s>";
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 61%]

* [PATCH 1/2] send-email: specify content-type of --compose body
@ 2008-03-25 23:02 61% Jeff King
  0 siblings, 0 replies; 200+ results
From: Jeff King @ 2008-03-25 23:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Teemu Likonen

If the compose message contains non-ascii characters, then
we assume it is in utf-8 and include the appropriate MIME
headers. If the user has already included a MIME-Version
header, then we assume they know what they are doing and
don't add any headers.

Signed-off-by: Jeff King <peff@peff.net>
---
 git-send-email.perl   |   24 ++++++++++++++++++++++++
 t/t9001-send-email.sh |   44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 9e568bf..7c4f06c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -520,8 +520,22 @@ EOT
 	open(C,"<",$compose_filename)
 		or die "Failed to open $compose_filename : " . $!;
 
+	my $need_8bit_cte = file_has_nonascii($compose_filename);
+	my $in_body = 0;
 	while(<C>) {
 		next if m/^GIT: /;
+		if (!$in_body && /^\n$/) {
+			$in_body = 1;
+			if ($need_8bit_cte) {
+				print C2 "MIME-Version: 1.0\n",
+					 "Content-Type: text/plain; ",
+					   "charset=utf-8\n",
+					 "Content-Transfer-Encoding: 8bit\n";
+			}
+		}
+		if (!$in_body && /^MIME-Version:/i) {
+			$need_8bit_cte = 0;
+		}
 		print C2 $_;
 	}
 	close(C);
@@ -958,3 +972,13 @@ sub validate_patch {
 	}
 	return undef;
 }
+
+sub file_has_nonascii {
+	my $fn = shift;
+	open(my $fh, '<', $fn)
+		or die "unable to open $fn: $!\n";
+	while (my $line = <$fh>) {
+		return 1 if $line =~ /[^[:ascii:]]/;
+	}
+	return 0;
+}
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c0973b4..e222c49 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -166,4 +166,48 @@ test_expect_success 'second message is patch' '
 	grep "Subject:.*Second" msgtxt2
 '
 
+test_expect_success '--compose adds MIME for utf8 body' '
+	clean_fake_sendmail &&
+	(echo "#!/bin/sh" &&
+	 echo "echo utf8 body: àéìöú >>\$1"
+	) >fake-editor-utf8 &&
+	chmod +x fake-editor-utf8 &&
+	echo y | \
+	  GIT_EDITOR=$(pwd)/fake-editor-utf8 \
+	  GIT_SEND_EMAIL_NOTTY=1 \
+	  git send-email \
+	  --compose --subject foo \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^utf8 body" msgtxt1 &&
+	grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
+'
+
+test_expect_success '--compose respects user mime type' '
+	clean_fake_sendmail &&
+	(echo "#!/bin/sh" &&
+	 echo "(echo MIME-Version: 1.0"
+	 echo " echo Content-Type: text/plain\\; charset=iso-8859-1"
+	 echo " echo Content-Transfer-Encoding: 8bit"
+	 echo " echo Subject: foo"
+	 echo " echo "
+	 echo " echo utf8 body: àéìöú) >\$1"
+	) >fake-editor-utf8-mime &&
+	chmod +x fake-editor-utf8-mime &&
+	echo y | \
+	  GIT_EDITOR=$(pwd)/fake-editor-utf8-mime \
+	  GIT_SEND_EMAIL_NOTTY=1 \
+	  git send-email \
+	  --compose --subject foo \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^utf8 body" msgtxt1 &&
+	grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1 &&
+	! grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
+'
+
 test_done
-- 
1.5.5.rc1.123.ge5f4e6

^ permalink raw reply related	[relevance 61%]

* [PATCH] send-email: lazily assign editor variable
  @ 2010-03-22 16:12 61% ` Michael J Gruber
  2010-03-22 23:25 57% ` [PATCH] send-email: do not check for editor until needed Jonathan Nieder
  1 sibling, 0 replies; 200+ results
From: Michael J Gruber @ 2010-03-22 16:12 UTC (permalink / raw)
  To: git; +Cc: Uwe Kleine-König, Junio C Hamano

b4479f0 (add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR",
2009-10-30) introduced the use of git var GIT_EDITOR which may lead to
problems when send-mail is used without a tty.

Therefore, use git var GIT_EDITOR only when we actually edit something.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 git-send-email.perl |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index d612ae8..bb09c0d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -162,9 +162,12 @@ my $compose_filename;
 
 # Handle interactive edition of files.
 my $multiedit;
-my $editor = Git::command_oneline('var', 'GIT_EDITOR');
+my $editor;
 
 sub do_edit {
+	if (!defined($editor)) {
+		$editor = Git::command_oneline('var', 'GIT_EDITOR');
+	}
 	if (defined($multiedit) && !$multiedit) {
 		map {
 			system('sh', '-c', $editor.' "$@"', $editor, $_);
-- 
1.7.0.3.435.g097f4

^ permalink raw reply related	[relevance 61%]

* [PATCH] send-email: improve RFC2047 quote parsing
@ 2012-07-30 19:25 61% Thomas Rast
  0 siblings, 0 replies; 200+ results
From: Thomas Rast @ 2012-07-30 19:25 UTC (permalink / raw)
  To: git; +Cc: Christoph Miebach, Junio C Hamano, Jeff King,
	Jürgen Rühle

The RFC2047 unquoting, used to parse email addresses in From and Cc
headers, is broken in several ways:

* It erroneously substitutes ' ' for '_' in *the whole* header, even
  outside the quoted field. [Noticed by Christoph.]

* It is too liberal in its matching, and happily matches the start of
  one quoted chunk against the end of another, or even just something
  that looks like such an end. [Noticed by Junio.]

* It fundamentally cannot cope with encodings that are not a superset
  of ASCII, nor several (incompatible) encodings in the same header.

This patch fixes the first two by doing a more careful decoding of the
=AB outer quoting.  Fixing the fundamental issues is left for a
future, more intrusive, patch.

Noticed-by: Christoph Miebach <christoph.miebach@web.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

This is the easy part, fixed as per Junio's comment that it needs to
use a .*? match for the contents, and with a test.

 git-send-email.perl   | 10 ++++++----
 t/t9001-send-email.sh | 13 +++++++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index ef30c55..6647137 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -862,11 +862,13 @@ sub make_message_id {
 sub unquote_rfc2047 {
 	local ($_) = @_;
 	my $encoding;
-	if (s/=\?([^?]+)\?q\?(.*)\?=/$2/g) {
+	s{=\?([^?]+)\?q\?(.*?)\?=}{
 		$encoding = $1;
-		s/_/ /g;
-		s/=([0-9A-F]{2})/chr(hex($1))/eg;
-	}
+		my $e = $2;
+		$e =~ s/_/ /g;
+		$e =~ s/=([0-9A-F]{2})/chr(hex($1))/eg;
+		$e;
+	}eg;
 	return wantarray ? ($_, $encoding) : $_;
 }
 
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 8c12c65..0351228 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -841,6 +841,19 @@ test_expect_success $PREREQ '--compose adds MIME for utf8 subject' '
 	grep "^Subject: =?UTF-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
 '
 
+test_expect_success $PREREQ 'utf8 author is correctly passed on' '
+	clean_fake_sendmail &&
+	test_commit weird_author &&
+	test_when_finished "git reset --hard HEAD^" &&
+	git commit --amend --author "Füñný Nâmé <odd_?=mail@example.com>" &&
+	git format-patch --stdout -1 >funny_name.patch &&
+	git send-email --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  funny_name.patch &&
+	grep "^From: Füñný Nâmé <odd_?=mail@example.com>" msgtxt1
+'
+
 test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '
 	echo master > master &&
 	git add master &&
-- 
1.7.12.rc0.434.gd809d0f

^ permalink raw reply related	[relevance 61%]

* [PATCH 1/2] send-email: specify content-type of --compose body
    2008-03-28 21:29 63% ` [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters Jeff King
@ 2008-03-28 21:28 61% ` Jeff King
  1 sibling, 0 replies; 200+ results
From: Jeff King @ 2008-03-28 21:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

If the compose message contains non-ascii characters, then
we assume it is in utf-8 and include the appropriate MIME
headers. If the user has already included a MIME-Version
header, then we assume they know what they are doing and
don't add any headers.

Signed-off-by: Jeff King <peff@peff.net>
---
 git-send-email.perl   |   24 ++++++++++++++++++++++++
 t/t9001-send-email.sh |   44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 9e568bf..7c4f06c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -520,8 +520,22 @@ EOT
 	open(C,"<",$compose_filename)
 		or die "Failed to open $compose_filename : " . $!;
 
+	my $need_8bit_cte = file_has_nonascii($compose_filename);
+	my $in_body = 0;
 	while(<C>) {
 		next if m/^GIT: /;
+		if (!$in_body && /^\n$/) {
+			$in_body = 1;
+			if ($need_8bit_cte) {
+				print C2 "MIME-Version: 1.0\n",
+					 "Content-Type: text/plain; ",
+					   "charset=utf-8\n",
+					 "Content-Transfer-Encoding: 8bit\n";
+			}
+		}
+		if (!$in_body && /^MIME-Version:/i) {
+			$need_8bit_cte = 0;
+		}
 		print C2 $_;
 	}
 	close(C);
@@ -958,3 +972,13 @@ sub validate_patch {
 	}
 	return undef;
 }
+
+sub file_has_nonascii {
+	my $fn = shift;
+	open(my $fh, '<', $fn)
+		or die "unable to open $fn: $!\n";
+	while (my $line = <$fh>) {
+		return 1 if $line =~ /[^[:ascii:]]/;
+	}
+	return 0;
+}
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c0973b4..e222c49 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -166,4 +166,48 @@ test_expect_success 'second message is patch' '
 	grep "Subject:.*Second" msgtxt2
 '
 
+test_expect_success '--compose adds MIME for utf8 body' '
+	clean_fake_sendmail &&
+	(echo "#!/bin/sh" &&
+	 echo "echo utf8 body: àéìöú >>\$1"
+	) >fake-editor-utf8 &&
+	chmod +x fake-editor-utf8 &&
+	echo y | \
+	  GIT_EDITOR=$(pwd)/fake-editor-utf8 \
+	  GIT_SEND_EMAIL_NOTTY=1 \
+	  git send-email \
+	  --compose --subject foo \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^utf8 body" msgtxt1 &&
+	grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
+'
+
+test_expect_success '--compose respects user mime type' '
+	clean_fake_sendmail &&
+	(echo "#!/bin/sh" &&
+	 echo "(echo MIME-Version: 1.0"
+	 echo " echo Content-Type: text/plain\\; charset=iso-8859-1"
+	 echo " echo Content-Transfer-Encoding: 8bit"
+	 echo " echo Subject: foo"
+	 echo " echo "
+	 echo " echo utf8 body: àéìöú) >\$1"
+	) >fake-editor-utf8-mime &&
+	chmod +x fake-editor-utf8-mime &&
+	echo y | \
+	  GIT_EDITOR=$(pwd)/fake-editor-utf8-mime \
+	  GIT_SEND_EMAIL_NOTTY=1 \
+	  git send-email \
+	  --compose --subject foo \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^utf8 body" msgtxt1 &&
+	grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1 &&
+	! grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
+'
+
 test_done
-- 
1.5.5.rc1.141.g50ecd.dirty

^ permalink raw reply related	[relevance 61%]

* [PATCH 08/16] send-email: use \E***\Q instead of \*\*\*
                     ` (10 preceding siblings ...)
  2010-09-30 13:43 62% ` [PATCH 07/16] send-email: cleanup_compose_files doesn't need a prototype Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:43 61% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:43 61% ` [PATCH 15/16] send-email: make_message_id use "require" instead of "use" Ævar Arnfjörð Bjarmason
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:43 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Change the regex introduced in a03bc5b to use the \E...\Q escape
syntax instead of using backslashes. It's more readable like this, and
easier to grep for.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 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 ce9b5eb..1218bbe 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -705,7 +705,7 @@ if (!defined $auto_8bit_encoding && scalar %broken_encoding) {
 
 if (!$force) {
 	for my $f (@files) {
-		if (get_patch_subject($f) =~ /\*\*\* SUBJECT HERE \*\*\*/) {
+		if (get_patch_subject($f) =~ /\Q*** SUBJECT HERE ***\E/) {
 			die "Refusing to send because the patch\n\t$f\n"
 				. "has the template subject '*** SUBJECT HERE ***'. "
 				. "Pass --force if you really want to send.\n";
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 61%]

* [RFC PATCH v2 2/2] send-email: remove stray characters from usage
  @ 2023-11-15 17:39 61% ` Todd Zullinger
  0 siblings, 0 replies; 200+ results
From: Todd Zullinger @ 2023-11-15 17:39 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Ævar Arnfjörð Bjarmason,
	Ondřej Pohořelský

A few stray single quotes crept into the usage string in a2ce608244
(send-email docs: add format-patch options, 2021-10-25).  Remove them.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
This is not scrictly tied to the previous commit.  It just stood out
while I was reviewing the usage output.

 git-send-email.perl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 94046e0fb7..cd2f0ae14e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -28,8 +28,8 @@
 
 sub usage {
 	print <<EOT;
-git send-email' [<options>] <file|directory>
-git send-email' [<options>] <format-patch options>
+git send-email [<options>] <file|directory>
+git send-email [<options>] <format-patch options>
 git send-email --dump-aliases
 
   Composing:
-- 
2.43.0.rc2



^ permalink raw reply related	[relevance 61%]

* [PATCH] git-send-email.perl: check for lines longer than 998 characters
  @ 2008-01-18  7:47 61% ` Adam Piątyszek
  0 siblings, 0 replies; 200+ results
From: Adam Piątyszek @ 2008-01-18  7:47 UTC (permalink / raw)
  To: Jeff King; +Cc: git, gitster, Adam Piątyszek

According to RFC2822 (Internet Message Format), each line of a message
must be no more than 998 characters. This patch adds a check for the
length of each body line of a message and dies if the length exceeds
the limit.

Signed-off-by: Adam Piątyszek <ediap@users.sourceforge.net>
---
 git-send-email.perl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index e47994a..6d623ea 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -748,6 +748,9 @@ foreach my $t (@files) {
 				$header_done = 1;
 			}
 		} else {
+			if (length($_) > 998) {
+				die "(msg) This message contains lines longer than 998 characters,\nwhich can not be correctly send as plain text using SMTP.\n";
+			}
 			$message .=  $_;
 			if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {
 				my $c = $2;
-- 
1.5.4.rc3.4.g1633

^ permalink raw reply related	[relevance 61%]

* [PATCH] perl: use "use warnings" instead of -w
  @ 2010-09-24 20:00 61% ` Ævar Arnfjörð Bjarmason
  2010-09-24 20:00 56% ` [PATCH/RFC] perl: bump the required Perl version to 5.8 from 5.6.[21] Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-24 20:00 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jakub Narebski, Tor Arntsen, Randal L. Schwartz,
	Ævar Arnfjörð Bjarmason

Change the Perl scripts to turn on lexical warnings instead of setting
the global $^W variable via the -w switch.

The -w sets warnings for all code that interpreter runs, while "use
warnings" is lexically scoped. The former is probably not what the
authors wanted.

As an auxiliary benefit it's now possible to build Git with:

    PERL_PATH='/usr/bin/env perl'

Which would previously result in failures, since "#!/usr/bin/env perl -w"
doesn't work as a shebang.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

This is a re-send, it's independent of bumping the version to 5.8 (use
warnings was introduced in 5.6), but a good idea anyway.

 contrib/examples/git-svnimport.perl         |    2 +-
 contrib/fast-import/import-directories.perl |    3 ++-
 git-add--interactive.perl                   |    3 ++-
 git-archimport.perl                         |    2 +-
 git-cvsexportcommit.perl                    |    3 ++-
 git-cvsimport.perl                          |    2 +-
 git-send-email.perl                         |    2 +-
 7 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/contrib/examples/git-svnimport.perl b/contrib/examples/git-svnimport.perl
index 4576c4a..ead4c04 100755
--- a/contrib/examples/git-svnimport.perl
+++ b/contrib/examples/git-svnimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 # This tool is copyright (c) 2005, Matthias Urlichs.
 # It is released under the Gnu Public License, version 2.
diff --git a/contrib/fast-import/import-directories.perl b/contrib/fast-import/import-directories.perl
index 3a5da4a..7f3afa5 100755
--- a/contrib/fast-import/import-directories.perl
+++ b/contrib/fast-import/import-directories.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # Copyright 2008-2009 Peter Krefting <peter@softwolves.pp.se>
 #
@@ -140,6 +140,7 @@ by whitespace or other characters.
 
 # Globals
 use strict;
+use warnings;
 use integer;
 my $crlfmode = 0;
 my @revs;
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index a96fb53..77f60fa 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1,7 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 use 5.008;
 use strict;
+use warnings;
 use Git;
 
 binmode(STDOUT, ":raw");
diff --git a/git-archimport.perl b/git-archimport.perl
index 947638c..bc32f18 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # This tool is copyright (c) 2005, Martin Langhoff.
 # It is released under the Gnu Public License, version 2.
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 9a8188b..39a426e 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -1,7 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 use 5.008;
 use strict;
+use warnings;
 use Getopt::Std;
 use File::Temp qw(tempdir);
 use Data::Dumper;
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 53869fb..249aeaf 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 # This tool is copyright (c) 2005, Matthias Urlichs.
 # It is released under the Gnu Public License, version 2.
diff --git a/git-send-email.perl b/git-send-email.perl
index 314e59e..d10d869 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # Copyright 2002,2005 Greg Kroah-Hartman <greg@kroah.com>
 # Copyright 2005 Ryan Anderson <ryan@michonline.com>
-- 
1.7.3.256.g00e8a

^ permalink raw reply related	[relevance 61%]

* [PATCH] send-email: support coloring dry-run output
@ 2012-05-17 13:16 62% Nguyễn Thái Ngọc Duy
  0 siblings, 0 replies; 200+ results
From: Nguyễn Thái Ngọc Duy @ 2012-05-17 13:16 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

It highlights sendmail command and subject lines. The most important
lines to me.

I'm no Perl expert. This patch is by no means for submission. But
maybe it'll motivate someone to do a proper patch.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 git-send-email.perl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index ef30c55..033ca5e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1157,9 +1157,13 @@ X-Mailer: git-send-email $gitversion
 			    print "RCPT TO:<$entry>\n";
 			}
 		} else {
+			print color 'yellow';
 			print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n";
+			print color 'reset';
 		}
-		print $header, "\n";
+		my $colored_header = $header;
+		$colored_header =~ s/^(Subject: .*)/color("bold").$1.color("reset")/em;
+		print $colored_header, "\n";
 		if ($smtp) {
 			print "Result: ", $smtp->code, ' ',
 				($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
-- 
1.7.8.36.g69ee2

^ permalink raw reply related	[relevance 62%]

* [PATCH] Don't print an empty Cc header in SMTP mode when there's no cc recipient defined
  @ 2007-11-19 10:48 62% ` Ask Bjørn Hansen
  0 siblings, 0 replies; 200+ results
From: Ask Bjørn Hansen @ 2007-11-19 10:48 UTC (permalink / raw)
  To: git; +Cc: Ask Bjørn Hansen


Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
---

There's some duplicate code between "what we do for sendmail"
and "what we do for SMTP" paths that should be fixed - this doesn't
do that, it only makes the SMTP path skip empty Cc lines...

 git-send-email.perl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index fd0a4ad..65620ab 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -651,7 +651,11 @@ X-Mailer: git-send-email $gitversion
 		} else {
 			print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n";
 		}
-		print "From: $sanitized_sender\nSubject: $subject\nCc: $cc\nTo: $to\n\n";
+		print "From: $sanitized_sender\n"
+		     . "Subject: $subject\n"
+		     . ($cc ? "Cc: $cc\n" : "")
+		     . "To: $to\n"
+		     . "\n";
 		if ($smtp) {
 			print "Result: ", $smtp->code, ' ',
 				($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
-- 
1.5.3.5.561.g140d

^ permalink raw reply related	[relevance 62%]

* [PATCH 01/16] send-email: use lexical filehandle for opendir
                     ` (4 preceding siblings ...)
  2010-09-30 13:43 62% ` [PATCH 11/16] send-email: use (?:) instead of () if no match variables are needed Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:42 62% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:42 62% ` [PATCH 06/16] send-email: unique_email_list doesn't need a prototype Ævar Arnfjörð Bjarmason
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:42 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-send-email.perl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 8cc4161..2f18d83 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -512,12 +512,12 @@ while (defined(my $f = shift @ARGV)) {
 		push @rev_list_opts, "--", @ARGV;
 		@ARGV = ();
 	} elsif (-d $f and !check_file_rev_conflict($f)) {
-		opendir(DH,$f)
+		opendir my $dh, $f
 			or die "Failed to opendir $f: $!";
 
 		push @files, grep { -f $_ } map { catfile($f, $_) }
-				sort readdir(DH);
-		closedir(DH);
+				sort readdir $dh;
+		closedir $dh;
 	} elsif ((-f $f or -p $f) and !check_file_rev_conflict($f)) {
 		push @files, $f;
 	} else {
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* [PATCH 1/2] send-email: rfc822 forbids using <address@domain> without a non-empty "phrase"
  @ 2007-08-09 13:27 62% ` Uwe Kleine-König
  0 siblings, 0 replies; 200+ results
From: Uwe Kleine-König @ 2007-08-09 13:27 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Uwe Kleine-König

Email::Valid does respect this considering such a mailbox specification
invalid.  b06c6bc831cbb9e9eb82fd3ffd5a2b674cd940d0 addressed the issue, but
only if Email::Valid is available.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
---
 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 39e433b..a02ab96 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -408,8 +408,8 @@ sub extract_valid_address {
 	# check for a local address:
 	return $address if ($address =~ /^($local_part_regexp)$/);
 
+	$address =~ s/^\s*<(.*)>\s*$/$1/;
 	if ($have_email_valid) {
-		$address =~ s/^\s*<(.*)>\s*$/$1/;
 		return scalar Email::Valid->address($address);
 	} else {
 		# less robust/correct than the monster regexp in Email::Valid,
-- 
1.5.3.rc3.943.g14c81

^ permalink raw reply related	[relevance 62%]

* [PATCH] [RFC] send-email: honor --suppress-from --signed-off-cc
  2007-07-10 17:02 59% [PATCH] send-email: extend sanitize_address_rfc822 to do rfc2047 quoting Uwe Kleine-König
@ 2007-07-10 17:02 62% ` Uwe Kleine-König
  0 siblings, 0 replies; 200+ results
From: Uwe Kleine-König @ 2007-07-10 17:02 UTC (permalink / raw)
  To: git; +Cc: Uwe Kleine-König

From: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>

---
Not sure, if this is how it should be.  Maybe we need another flag?

Best regards
Uwe

 git-send-email.perl |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 8b3d450..a03153b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -641,9 +641,11 @@ foreach my $t (@files) {
 			if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {
 				my $c = $2;
 				chomp $c;
-				push @cc, $c;
-				printf("(sob) Adding cc: %s from line '%s'\n",
-					$c, $_) unless $quiet;
+				if (!$suppress_from or $c eq $from) {
+					push @cc, $c;
+					printf("(sob) Adding cc: %s from line '%s'\n",
+						$c, $_) unless $quiet;
+				}
 			}
 		}
 	}
-- 
1.5.3.rc0.823.gdedbf

^ permalink raw reply related	[relevance 62%]

* Make git-send-email detect mbox-style patches more readily
@ 2006-10-06 20:24 62% Matthew Wilcox
  0 siblings, 0 replies; 200+ results
From: Matthew Wilcox @ 2006-10-06 20:24 UTC (permalink / raw)
  To: git


Earlier today, I embarrassed myself by trying to construct a patch that
git-send-email would send, and I missed out the putting

>From garbage

line on the front, which led it to send the patches with a
Subject: From: Matthew Wilcox <matthew@wil.cx>
line.  Bad.

This patch makes git-send-email detect an mbox-style file more readily,
and correctly handles the patches I constructed.

--- git-core-willy/git-send-email.perl	2006-07-24 23:45:08.000000000 -0400
+++ git-core-1.4.1.1/git-send-email.perl	2006-10-06 16:02:37.000000000 -0400
@@ -451,6 +451,7 @@
 		if (!$header_done) {
 			$found_mbox = 1, next if (/^From /);
 			chomp;
+			$found_mbox = 1 if (/^(From|Date|Cc|Subject):/);
 
 			if ($found_mbox) {
 				if (/^Subject:\s+(.*)$/) {

^ permalink raw reply	[relevance 62%]

* [PATCH] Quick hack to avoid double qp encoding
  @ 2007-01-10 20:07 62% ` Juergen Ruehle
  0 siblings, 0 replies; 200+ results
From: Juergen Ruehle @ 2007-01-10 20:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jürgen Rühle

From: Jürgen_Rühle <j-r@online.de>

Signed-off-by: Jürgen Rühle <j-r@online.de>
---
 This is just a hack since I know next to nothing about perl.

 git-send-email.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index ba39d39..a4a22d3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -555,6 +555,7 @@ foreach my $t (@files) {
 	}
 	close F;
 	if (defined $author_not_sender) {
+		$author_not_sender =~ s/=\?utf-8\?q\?([^?]*)\?=/my $bla = $1; $bla =~ s|=([0-9a-fA-F]{2})|sprintf '%c', hex($1)|eg; $bla/eg;
 		$message = "From: $author_not_sender\n\n$message";
 	}
 
-- 
1.5.0.rc0.g525e

^ permalink raw reply related	[relevance 62%]

* [PATCH 10/9] Sanitize @to recipients.
  @ 2007-04-26  4:53 62%               ` Robin H. Johnson
  0 siblings, 0 replies; 200+ results
From: Robin H. Johnson @ 2007-04-26  4:53 UTC (permalink / raw)
  To: Robin H. Johnson, Git Mailing List; +Cc: Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 740 bytes --]

We need to sanitize @to as well to ensure that names are properly quoted.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
 git-send-email.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index e1562b3..a45439e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -274,6 +274,7 @@ sub expand_aliases {
 }
 
 @to = expand_aliases(@to);
+@to = (map { sanitize_address_rfc822($_) } @to);
 @initial_cc = expand_aliases(@initial_cc);
 @bcclist = expand_aliases(@bcclist);

-- 
Robin Hugh Johnson
Gentoo Linux Developer & Council Member
E-Mail     : robbat2@gentoo.org
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85

[-- Attachment #2: Type: application/pgp-signature, Size: 321 bytes --]

^ permalink raw reply related	[relevance 62%]

* [PATCH] Unquote From line from patch before comparing with given from address.
@ 2007-06-11 17:04 62% Kristian Høgsberg
  0 siblings, 0 replies; 200+ results
From: Kristian Høgsberg @ 2007-06-11 17:04 UTC (permalink / raw)
  To: git

This makes --suppress-from actually work when you're unfortunate enough
to have non-ASCII in your name.  Also, if there's a match use the optionally
RFC2047 quoted version from the email.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---
 git-send-email.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index eb876f8..7c0c90b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -561,7 +561,8 @@ foreach my $t (@files) {
 					$subject = $1;
 
 				} elsif (/^(Cc|From):\s+(.*)$/) {
-					if ($2 eq $from) {
+					if (unquote_rfc2047($2) eq $from) {
+						$from = $2;
 						next if ($suppress_from);
 					}
 					elsif ($1 eq 'From') {
-- 
1.5.2.GIT

^ permalink raw reply related	[relevance 62%]

* [PATCH] Don't add To: recipients to the Cc: header
@ 2007-11-19 11:00 62% Ask Bjørn Hansen
  0 siblings, 0 replies; 200+ results
From: Ask Bjørn Hansen @ 2007-11-19 11:00 UTC (permalink / raw)
  To: git; +Cc: Ask Bjørn Hansen


Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
---
 git-send-email.perl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 65620ab..530b456 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -557,8 +557,11 @@ sub sanitize_address
 sub send_message
 {
 	my @recipients = unique_email_list(@to);
-	@cc = (map { sanitize_address($_) } @cc);
+	@cc = (grep { my $cc = extract_valid_address($_);
+		      not grep { $cc eq $_ } @recipients
+		    }
+	       map { sanitize_address($_) }
+	       @cc);
 	my $to = join (",\n\t", @recipients);
 	@recipients = unique_email_list(@recipients,@cc,@bcclist);
 	@recipients = (map { extract_valid_address($_) } @recipients);
-- 
1.5.3.5.561.g140d

^ permalink raw reply related	[relevance 62%]

* [PATCH] git-send-email: Don't add To: recipients to the Cc: header too
@ 2007-11-20  9:34 62% Ask Bjørn Hansen
  0 siblings, 0 replies; 200+ results
From: Ask Bjørn Hansen @ 2007-11-20  9:34 UTC (permalink / raw)
  To: git; +Cc: Ask Bjørn Hansen


Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
---
 git-send-email.perl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index fd0a4ad..b832d2d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -557,7 +557,11 @@ sub sanitize_address
 sub send_message
 {
 	my @recipients = unique_email_list(@to);
-	@cc = (map { sanitize_address($_) } @cc);
+	@cc = (grep { my $cc = extract_valid_address($_);
+		      not grep { $cc eq $_ } @recipients
+		    }
+	       map { sanitize_address($_) }
+	       @cc);
 	my $to = join (",\n\t", @recipients);
 	@recipients = unique_email_list(@recipients,@cc,@bcclist);
 	@recipients = (map { extract_valid_address($_) } @recipients);
-- 
1.5.3.5.561.g140d

^ permalink raw reply related	[relevance 62%]

* Re: git-send-email.perl defect: address missing trailing > accepted
  @ 2009-10-20 22:29 62% ` Erik Faye-Lund
  0 siblings, 0 replies; 200+ results
From: Erik Faye-Lund @ 2009-10-20 22:29 UTC (permalink / raw)
  To: Joe Perches; +Cc: git

On Wed, Oct 21, 2009 at 12:12 AM, Joe Perches <joe@perches.com> wrote:
> I typo cut/pasted an invalid email address,
> neglecting to copy the trailing ">".
>
> was:    "Name <addr.org"
> needed: "Name <addr.org>"
>
> Anyone have suggestions on how to get
> git-send-email.perl to notify and abort
> sending on more invalid address styles?

Something along these lines? Of course, the error message is, uhm,
less than helpful :)

--->8---
diff --git a/git-send-email.perl b/git-send-email.perl
index f5ba4e7..83f5e80 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -787,6 +787,10 @@ sub is_rfc2047_quoted {
 sub sanitize_address
 {
 	my ($recipient) = @_;
+	if ($recipient =~ m/.*<[^>]*$/) {
+		die "EEK!"
+	}
+
 	my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\s*(<.*)/);

 	if (not $recipient_name) {


-- 
Erik "kusma" Faye-Lund

^ permalink raw reply related	[relevance 62%]

* [PATCH 04/16] send-email: get_patch_subject doesn't need a prototype
    2010-09-30 13:43 64% ` [PATCH 16/16] send-email: use Perl idioms in while loop Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:42 62% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:42 62% ` [PATCH 05/16] send-email: file_declares_8bit_cte " Ævar Arnfjörð Bjarmason
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:42 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 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 488d894..b50c963 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -549,7 +549,7 @@ if (@files) {
 	usage();
 }
 
-sub get_patch_subject($) {
+sub get_patch_subject {
 	my $fn = shift;
 	open (my $fh, '<', $fn);
 	while (my $line = <$fh>) {
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* [PATCH 06/16] send-email: unique_email_list doesn't need a prototype
                     ` (5 preceding siblings ...)
  2010-09-30 13:42 62% ` [PATCH 01/16] send-email: use lexical filehandle for opendir Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:42 62% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:43 62% ` [PATCH 12/16] send-email: is_rfc2047_quoted use qr// regexes Ævar Arnfjörð Bjarmason
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:42 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-send-email.perl |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index f471888..90b777a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -136,7 +136,6 @@ my $have_mail_address = eval { require Mail::Address; 1 };
 my $smtp;
 my $auth;
 
-sub unique_email_list(@);
 sub cleanup_compose_files();
 
 # Variables we fill in automatically, or via prompting:
@@ -1332,7 +1331,7 @@ sub cleanup_compose_files() {
 
 $smtp->quit if $smtp;
 
-sub unique_email_list(@) {
+sub unique_email_list {
 	my %seen;
 	my @emails;
 
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* [PATCH 05/16] send-email: file_declares_8bit_cte doesn't need a prototype
    2010-09-30 13:43 64% ` [PATCH 16/16] send-email: use Perl idioms in while loop Ævar Arnfjörð Bjarmason
  2010-09-30 13:42 62% ` [PATCH 04/16] send-email: get_patch_subject doesn't need a prototype Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:42 62% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:43 62% ` [PATCH 09/16] send-email: sanitize_address use $foo, not "$foo" Ævar Arnfjörð Bjarmason
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:42 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 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 b50c963..f471888 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -679,7 +679,7 @@ sub ask {
 
 my %broken_encoding;
 
-sub file_declares_8bit_cte($) {
+sub file_declares_8bit_cte {
 	my $fn = shift;
 	open (my $fh, '<', $fn);
 	while (my $line = <$fh>) {
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* [PATCH 07/16] send-email: cleanup_compose_files doesn't need a prototype
                     ` (9 preceding siblings ...)
  2010-09-30 13:43 62% ` [PATCH 14/16] send-email: send_message die on $!, not $? Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:43 62% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:43 61% ` [PATCH 08/16] send-email: use \E***\Q instead of \*\*\* Ævar Arnfjörð Bjarmason
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:43 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-send-email.perl |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 90b777a..ce9b5eb 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -136,8 +136,6 @@ my $have_mail_address = eval { require Mail::Address; 1 };
 my $smtp;
 my $auth;
 
-sub cleanup_compose_files();
-
 # Variables we fill in automatically, or via prompting:
 my (@to,$no_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
 	$initial_reply_to,$initial_subject,@files,
@@ -1325,7 +1323,7 @@ foreach my $t (@files) {
 
 cleanup_compose_files();
 
-sub cleanup_compose_files() {
+sub cleanup_compose_files {
 	unlink($compose_filename, $compose_filename . ".final") if $compose;
 }
 
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* [PATCH 10/16] send-email: sanitize_address use qq["foo"], not "\"foo\""
                     ` (7 preceding siblings ...)
  2010-09-30 13:43 62% ` [PATCH 12/16] send-email: is_rfc2047_quoted use qr// regexes Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:43 62% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:43 62% ` [PATCH 14/16] send-email: send_message die on $!, not $? Ævar Arnfjörð Bjarmason
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:43 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Perl provides an alternate quote syntax which can make using "" inside
interpolated strings easier to read.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 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 1bf090a..c012b95 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -881,7 +881,7 @@ sub sanitize_address {
 	# double quotes are needed if specials or CTLs are included
 	elsif ($recipient_name =~ /[][()<>@,;:\\".\000-\037\177]/) {
 		$recipient_name =~ s/(["\\\r])/\\$1/g;
-		$recipient_name = "\"$recipient_name\"";
+		$recipient_name = qq["$recipient_name"];
 	}
 
 	return "$recipient_name $recipient_addr";
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* [PATCH 11/16] send-email: use (?:) instead of () if no  match variables are needed
                     ` (3 preceding siblings ...)
  2010-09-30 13:43 62% ` [PATCH 09/16] send-email: sanitize_address use $foo, not "$foo" Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:43 62% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:42 62% ` [PATCH 01/16] send-email: use lexical filehandle for opendir Ævar Arnfjörð Bjarmason
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:43 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 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 c012b95..5a0c4a8 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -365,7 +365,7 @@ my(%suppress_cc);
 if (@suppress_cc) {
 	foreach my $entry (@suppress_cc) {
 		die "Unknown --suppress-cc field: '$entry'\n"
-			unless $entry =~ /^(all|cccmd|cc|author|self|sob|body|bodycc)$/;
+			unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc)$/;
 		$suppress_cc{$entry} = 1;
 	}
 }
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* [PATCH 12/16] send-email: is_rfc2047_quoted use qr// regexes
                     ` (6 preceding siblings ...)
  2010-09-30 13:42 62% ` [PATCH 06/16] send-email: unique_email_list doesn't need a prototype Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:43 62% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:43 62% ` [PATCH 10/16] send-email: sanitize_address use qq["foo"], not "\"foo\"" Ævar Arnfjörð Bjarmason
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:43 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-send-email.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 5a0c4a8..b87c3f2 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -852,8 +852,8 @@ sub quote_rfc2047 {
 
 sub is_rfc2047_quoted {
 	my $s = shift;
-	my $token = '[^][()<>@,;:"\/?.= \000-\037\177-\377]+';
-	my $encoded_text = '[!->@-~]+';
+	my $token = qr/[^][()<>@,;:"\/?.= \000-\037\177-\377]+/;
+	my $encoded_text = qr/[!->@-~]+/;
 	length($s) <= 75 &&
 	$s =~ m/^(?:"[[:ascii:]]*"|=\?$token\?$token\?$encoded_text\?=)$/o;
 }
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* [PATCH 14/16] send-email: send_message die on $!, not $?
                     ` (8 preceding siblings ...)
  2010-09-30 13:43 62% ` [PATCH 10/16] send-email: sanitize_address use qq["foo"], not "\"foo\"" Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:43 62% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:43 62% ` [PATCH 07/16] send-email: cleanup_compose_files doesn't need a prototype Ævar Arnfjörð Bjarmason
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:43 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

If close fails we want to emit errno, not the return code of whatever
happened to be the child process run.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 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 47d86ad..9cb6aa6 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1035,7 +1035,7 @@ X-Mailer: git-send-email $gitversion
 			exec($smtp_server, @sendmail_parameters) or die $!;
 		}
 		print $sm "$header\n$message";
-		close $sm or die $?;
+		close $sm or die $!;
 	} else {
 
 		if (!defined $smtp_server) {
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* [PATCH 09/16] send-email: sanitize_address use $foo, not "$foo"
                     ` (2 preceding siblings ...)
  2010-09-30 13:42 62% ` [PATCH 05/16] send-email: file_declares_8bit_cte " Ævar Arnfjörð Bjarmason
@ 2010-09-30 13:43 62% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:43 62% ` [PATCH 11/16] send-email: use (?:) instead of () if no match variables are needed Ævar Arnfjörð Bjarmason
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:43 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

There's no reason to explicitly stringify a variable in Perl unless
it's an overloaded object and you want to call overload::StrVal,
otherwise it's just creating a new scalar redundantly.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 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 1218bbe..1bf090a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -864,7 +864,7 @@ sub sanitize_address {
 	my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\s*(<.*)/);
 
 	if (not $recipient_name) {
-		return "$recipient";
+		return $recipient;
 	}
 
 	# if recipient_name is already quoted, do nothing
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* [PATCH v2 13/16] send-email: extract_valid_address use qr// regexes
  2010-09-30 13:43 60% ` [PATCH 13/16] send-email: extract_valid_address use qr// regexes and /o Ævar Arnfjörð Bjarmason
@ 2010-09-30 19:03 62%   ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 19:03 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

Here's v2 which omits the confusing /o addition and just uses the more
correct qr// syntax over qq//.

 git-send-email.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index b87c3f2..30000b9 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -777,8 +777,8 @@ our ($message_id, %mail, $subject, $reply_to, $references, $message,
 
 sub extract_valid_address {
 	my $address = shift;
-	my $local_part_regexp = '[^<>"\s@]+';
-	my $domain_regexp = '[^.<>"\s@]+(?:\.[^.<>"\s@]+)+';
+	my $local_part_regexp = qr/[^<>"\s@]+/;
+	my $domain_regexp = qr/[^.<>"\s@]+(?:\.[^.<>"\s@]+)+/;
 
 	# check for a local address:
 	return $address if ($address =~ /^($local_part_regexp)$/);
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 62%]

* Re: git-send-email: smtpserver in $HOME
  @ 2021-02-16  2:14 62% ` Junio C Hamano
  2021-02-16 12:49 60%   ` Jan “Khardix” Staněk
  0 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2021-02-16  2:14 UTC (permalink / raw)
  To: Jan “Khardix” Staněk; +Cc: git

Jan “Khardix” Staněk  <khardix@gmail.com> writes:

> Would it be feasible to treat the `smtpserver` as path option
> and expand `~`/`~user` paths?
> Would it break anything
> (i.e., is `~` a valid character for beginning of a hostname)?

I haven't given too much thought, but offhand do not think of a
reason why a change like the attached would break things.



 git-send-email.perl | 2 ++
 1 file changed, 2 insertions(+)

diff --git c/git-send-email.perl w/git-send-email.perl
index 1f425c0809..ff58ac5046 100755
--- c/git-send-email.perl
+++ w/git-send-email.perl
@@ -1006,6 +1006,8 @@ sub expand_one_alias {
 		}
 	}
 	$smtp_server ||= 'localhost'; # could be 127.0.0.1, too... *shrug*
+} elsif ($smtp_server =~ /^~/) {
+	$smtp_server = glob($smtp_server);
 }
 
 if ($compose && $compose > 0) {

^ permalink raw reply related	[relevance 62%]

* [PATCH] send-email: remove stray characters from usage
  @ 2023-11-16 19:36 62% ` Todd Zullinger
  0 siblings, 0 replies; 200+ results
From: Todd Zullinger @ 2023-11-16 19:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

A few stray single quotes crept into the usage string in a2ce608244
(send-email docs: add format-patch options, 2021-10-25).  Remove them.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
[I trimmed the Cc: list]

Junio C Hamano wrote:
> Thanks.  Let's split this out as a docfix patch and handle it
> separately.

Done. :)

 git-send-email.perl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index cacdbd6bb2..d24e981d61 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -28,8 +28,8 @@
 
 sub usage {
 	print <<EOT;
-git send-email' [<options>] <file|directory>
-git send-email' [<options>] <format-patch options>
+git send-email [<options>] <file|directory>
+git send-email [<options>] <format-patch options>
 git send-email --dump-aliases
 
   Composing:
-- 
2.43.0.rc2



^ permalink raw reply related	[relevance 62%]

* [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters
       [not found]     <7caf19ae394accab538d2f94953bb62b55a2c79f.1206486012.git.peff@peff.net>
@ 2008-03-25 23:03 63% ` Jeff King
    0 siblings, 1 reply; 200+ results
From: Jeff King @ 2008-03-25 23:03 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Teemu Likonen

We always use 'utf-8' as the encoding, since we currently
have no way of getting the information from the user.

This also refactors the quoting of recipient names, since
both processes can share the rfc2047 quoting code.

Signed-off-by: Jeff King <peff@peff.net>
---
 git-send-email.perl   |   18 +++++++++++++++---
 t/t9001-send-email.sh |   15 +++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 7c4f06c..075cd0b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -501,7 +501,12 @@ if ($compose) {
 	open(C,">",$compose_filename)
 		or die "Failed to open for writing $compose_filename: $!";
 	print C "From $sender # This line is ignored.\n";
-	printf C "Subject: %s\n\n", $initial_subject;
+	print C "Subject: ",
+		($initial_subject =~ /[^[:ascii:]]/ ?
+		quote_rfc2047($initial_subject) :
+		$initial_subject),
+		"\n";
+	print C "\n";
 	printf C <<EOT;
 GIT: Please enter your email below.
 GIT: Lines beginning in "GIT: " will be removed.
@@ -626,6 +631,14 @@ sub unquote_rfc2047 {
 	return wantarray ? ($_, $encoding) : $_;
 }
 
+sub quote_rfc2047 {
+	local $_ = shift;
+	my $encoding = shift || 'utf-8';
+	s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
+	s/(.*)/=\?$encoding\?q\?$1\?=/;
+	return $_;
+}
+
 # use the simplest quoting being able to handle the recipient
 sub sanitize_address
 {
@@ -643,8 +656,7 @@ sub sanitize_address
 
 	# rfc2047 is needed if a non-ascii char is included
 	if ($recipient_name =~ /[^[:ascii:]]/) {
-		$recipient_name =~ s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
-		$recipient_name =~ s/(.*)/=\?utf-8\?q\?$1\?=/;
+		$recipient_name = quote_rfc2047($recipient_name);
 	}
 
 	# double quotes are needed if specials or CTLs are included
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e222c49..a4bcd28 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -210,4 +210,19 @@ test_expect_success '--compose respects user mime type' '
 	! grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
 '
 
+test_expect_success '--compose adds MIME for utf8 subject' '
+	clean_fake_sendmail &&
+	echo y | \
+	  GIT_EDITOR=$(pwd)/fake-editor \
+	  GIT_SEND_EMAIL_NOTTY=1 \
+	  git send-email \
+	  --compose --subject utf8-sübjëct \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^fake edit" msgtxt1 &&
+	grep "^Subject: =?utf-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
+'
+
 test_done
-- 
1.5.5.rc1.123.ge5f4e6

^ permalink raw reply related	[relevance 63%]

* [PATCH] send-email: apply --suppress-from to S-o-b and cc-cmd
@ 2007-11-07  7:34 63% Uwe Kleine-König
  0 siblings, 0 replies; 200+ results
From: Uwe Kleine-König @ 2007-11-07  7:34 UTC (permalink / raw)
  To: git; +Cc: Uwe Kleine-König, Ryan Anderson

From: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>

Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Cc: Ryan Anderson <ryan@michonline.com>
---
Hello,

I don't see the sense in adding the sender to Cc: from Signed-off-by
lines but not from From:.  If someone is convinced it makes sense, I'm
willing to send a new patch that uses a different option.

Cc'd Ryan as the author of --suppress-from.

I already tried to send this from my work's email account, but it seems
to have problems to send mails to vger (and lists.arm.linux.org.uk).
Sorry Ryan if you get this mail once more.

Best regards
Uwe

 Documentation/git-send-email.txt |    3 +--
 git-send-email.perl              |    5 +++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index e38b702..659215a 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -113,8 +113,7 @@ The --cc option must be repeated for each user you want on the cc list.
 	is not set, this will be prompted for.
 
 --suppress-from, --no-suppress-from::
-        If this is set, do not add the From: address to the cc: list, if it
-        shows up in a From: line.
+        If this is set, do not add the From: address to the cc: list.
         Default is the value of 'sendemail.suppressfrom' configuration value;
         if that is unspecified, default to --no-suppress-from.
 
diff --git a/git-send-email.perl b/git-send-email.perl
index 96051bc..f4b8f96 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -88,8 +88,7 @@ Options:
 
    --smtp-ssl     If set, connects to the SMTP server using SSL.
 
-   --suppress-from Suppress sending emails to yourself if your address
-                  appears in a From: line. Defaults to off.
+   --suppress-from Suppress sending emails to yourself. Defaults to off.
 
    --thread       Specify that the "In-Reply-To:" header should be set on all
                   emails. Defaults to on.
@@ -730,6 +729,7 @@ foreach my $t (@files) {
 			if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {
 				my $c = $2;
 				chomp $c;
+				next if ($c eq $sender and $suppress_from);
 				push @cc, $c;
 				printf("(sob) Adding cc: %s from line '%s'\n",
 					$c, $_) unless $quiet;
@@ -745,6 +745,7 @@ foreach my $t (@files) {
 			my $c = $_;
 			$c =~ s/^\s*//g;
 			$c =~ s/\n$//g;
+			next if ($c eq $sender and $suppress_from);
 			push @cc, $c;
 			printf("(cc-cmd) Adding cc: %s from: '%s'\n",
 				$c, $cc_cmd) unless $quiet;
-- 
1.5.3.4

^ permalink raw reply related	[relevance 63%]

* [PATCH 2/2] git-send-email: Add some short options
  2010-12-09  4:44 60% [PATCH] git-send-email: Accept -n as a synonym for --dry-run Alejandro R. Sedeño
@ 2010-12-10 18:44 63% ` Alejandro R. Sedeño
  0 siblings, 0 replies; 200+ results
From: Alejandro R. Sedeño @ 2010-12-10 18:44 UTC (permalink / raw)
  To: git; +Cc: Thomas Rast

* Accept -n as a synonym for --dry-run
* Accept -f as a synonym for --force
* Accept -q as a synonym for --quiet

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
---
 Documentation/git-send-email.txt |    3 +++
 git-send-email.perl              |   12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 7ec9dab..2d0faf2 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -297,6 +297,7 @@ Default is the value of 'sendemail.confirm' configuration value; if that
 is unspecified, default to 'auto' unless any of the suppress options
 have been specified, in which case default to 'compose'.
 
+-n::
 --dry-run::
 	Do everything except actually send the emails.
 
@@ -306,6 +307,7 @@ have been specified, in which case default to 'compose'.
 	or as a file name ('--no-format-patch'). By default, when such a conflict
 	occurs, git send-email will fail.
 
+-q::
 --quiet::
 	Make git-send-email less verbose.  One line per email should be
 	all that is output.
@@ -322,6 +324,7 @@ have been specified, in which case default to 'compose'.
 Default is the value of 'sendemail.validate'; if this is not set,
 default to '--validate'.
 
+-f::
 --force::
 	Send emails even if safety checks would prevent it.
 
diff --git a/git-send-email.perl b/git-send-email.perl
index 76565de..ede7835 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -84,12 +84,12 @@ git send-email [options] <file | directory | rev-list options >
   Administering:
     --confirm               <str>  * Confirm recipients before sending;
                                      auto, cc, compose, always, or never.
-    --quiet                        * Output one line of info per email.
-    --dry-run                      * Don't actually send the emails.
+    -q, --quiet                    * Output one line of info per email.
+    -n, --dry-run                  * Don't actually send the emails.
     --[no-]validate                * Perform patch sanity checks. Default on.
     --[no-]format-patch            * understand any non optional arguments as
                                      `git format-patch` ones.
-    --force                        * Send even if safety checks would prevent it.
+    -f, --force                    * Send even if safety checks would prevent it.
 
 EOT
 	exit(1);
@@ -298,19 +298,19 @@ my $rc = GetOptions("sender|from=s" => \$sender,
 		    "identity=s" => \$identity,
 		    "annotate" => \$annotate,
 		    "compose" => \$compose,
-		    "quiet" => \$quiet,
+		    "quiet|q" => \$quiet,
 		    "cc-cmd=s" => \$cc_cmd,
 		    "suppress-from!" => \$suppress_from,
 		    "suppress-cc=s" => \@suppress_cc,
 		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
 		    "confirm=s" => \$confirm,
-		    "dry-run" => \$dry_run,
+		    "dry-run|n" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 		    "thread!" => \$thread,
 		    "validate!" => \$validate,
 		    "format-patch!" => \$format_patch,
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
-		    "force" => \$force,
+		    "force|f" => \$force,
 	 );
 
 unless ($rc) {
-- 
1.7.3.3

^ permalink raw reply related	[relevance 63%]

* [PATCH] perl libs: perl -w + use warnings is redundant
@ 2010-05-21 14:50 63% Ævar Arnfjörð Bjarmason
  2010-05-21 16:52 60% ` [PATCH 1/2] " Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-05-21 14:50 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason

Change the Perl scripts to turn on lexical warnings, but only in Perl
scripts that definitely require 5.6.0 or later. I.e. those that either
did 'use warnings' in addition to -w already, or used the three-arg
form of open.

-w sets warnings for all code that interpreter runs. "use warnings" is
lexically scoped. The former is probably not what the authors wanted.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 contrib/examples/git-svnimport.perl         |    2 +-
 contrib/fast-import/import-directories.perl |    3 ++-
 git-add--interactive.perl                   |    3 ++-
 git-archimport.perl                         |    2 +-
 git-send-email.perl                         |    2 +-
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/contrib/examples/git-svnimport.perl b/contrib/examples/git-svnimport.perl
index 4576c4a..ead4c04 100755
--- a/contrib/examples/git-svnimport.perl
+++ b/contrib/examples/git-svnimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 # This tool is copyright (c) 2005, Matthias Urlichs.
 # It is released under the Gnu Public License, version 2.
diff --git a/contrib/fast-import/import-directories.perl b/contrib/fast-import/import-directories.perl
index 3a5da4a..7f3afa5 100755
--- a/contrib/fast-import/import-directories.perl
+++ b/contrib/fast-import/import-directories.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # Copyright 2008-2009 Peter Krefting <peter@softwolves.pp.se>
 #
@@ -140,6 +140,7 @@ by whitespace or other characters.
 
 # Globals
 use strict;
+use warnings;
 use integer;
 my $crlfmode = 0;
 my @revs;
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 21f1330..c2e7ab4 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1,6 +1,7 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 use strict;
+use warnings;
 use Git;
 
 binmode(STDOUT, ":raw");
diff --git a/git-archimport.perl b/git-archimport.perl
index 98f3ede..6ee3fca 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # This tool is copyright (c) 2005, Martin Langhoff.
 # It is released under the Gnu Public License, version 2.
diff --git a/git-send-email.perl b/git-send-email.perl
index 111c981..bbb03f7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # Copyright 2002,2005 Greg Kroah-Hartman <greg@kroah.com>
 # Copyright 2005 Ryan Anderson <ryan@michonline.com>
-- 
1.7.1.98.g4a5f

^ permalink raw reply related	[relevance 63%]

* [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters
  @ 2008-03-28 21:29 63% ` Jeff King
  2008-03-28 21:28 61% ` [PATCH 1/2] send-email: specify content-type of --compose body Jeff King
  1 sibling, 0 replies; 200+ results
From: Jeff King @ 2008-03-28 21:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

We always use 'utf-8' as the encoding, since we currently
have no way of getting the information from the user.

This also refactors the quoting of recipient names, since
both processes can share the rfc2047 quoting code.

Signed-off-by: Jeff King <peff@peff.net>
---
 git-send-email.perl   |   19 +++++++++++++++++--
 t/t9001-send-email.sh |   15 +++++++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 7c4f06c..d0f9d4a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -536,6 +536,14 @@ EOT
 		if (!$in_body && /^MIME-Version:/i) {
 			$need_8bit_cte = 0;
 		}
+		if (!$in_body && /^Subject: ?(.*)/i) {
+			my $subject = $1;
+			$_ = "Subject: " .
+				($subject =~ /[^[:ascii:]]/ ?
+				 quote_rfc2047($subject) :
+				 $subject) .
+				"\n";
+		}
 		print C2 $_;
 	}
 	close(C);
@@ -626,6 +634,14 @@ sub unquote_rfc2047 {
 	return wantarray ? ($_, $encoding) : $_;
 }
 
+sub quote_rfc2047 {
+	local $_ = shift;
+	my $encoding = shift || 'utf-8';
+	s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
+	s/(.*)/=\?$encoding\?q\?$1\?=/;
+	return $_;
+}
+
 # use the simplest quoting being able to handle the recipient
 sub sanitize_address
 {
@@ -643,8 +659,7 @@ sub sanitize_address
 
 	# rfc2047 is needed if a non-ascii char is included
 	if ($recipient_name =~ /[^[:ascii:]]/) {
-		$recipient_name =~ s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
-		$recipient_name =~ s/(.*)/=\?utf-8\?q\?$1\?=/;
+		$recipient_name = quote_rfc2047($recipient_name);
 	}
 
 	# double quotes are needed if specials or CTLs are included
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e222c49..a4bcd28 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -210,4 +210,19 @@ test_expect_success '--compose respects user mime type' '
 	! grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
 '
 
+test_expect_success '--compose adds MIME for utf8 subject' '
+	clean_fake_sendmail &&
+	echo y | \
+	  GIT_EDITOR=$(pwd)/fake-editor \
+	  GIT_SEND_EMAIL_NOTTY=1 \
+	  git send-email \
+	  --compose --subject utf8-sübjëct \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^fake edit" msgtxt1 &&
+	grep "^Subject: =?utf-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
+'
+
 test_done
-- 
1.5.5.rc1.141.g50ecd.dirty

^ permalink raw reply related	[relevance 63%]

* [PATCH 4/4] send-email: ensure quoted addresses are rfc2047 encoded
  @ 2009-03-31 16:22 63%       ` Jay Soffian
  0 siblings, 0 replies; 200+ results
From: Jay Soffian @ 2009-03-31 16:22 UTC (permalink / raw)
  To: git
  Cc: Jay Soffian, Matthieu Moy, Junio C Hamano, Björn Steinbrink,
	Uwe Kleine-König

sanitize_address assumes that quoted addresses (e.g., "first last"
<first.last@example.com) do not need rfc2047 encoding, but this is
not always the case.

For example, various places in send-email extract addresses using
parse_address_line. parse_address_line returns the addresses already
quoted (e.g., "first last" <first.last@example.com), but not rfc2047
encoded.

This patch makes sanitize_address stricter about what needs rfc2047
encoding and adds a test demonstrating where I noticed the problem.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---
 git-send-email.perl   |    3 ++-
 t/t9001-send-email.sh |   13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index fc153f9..6bbdfec 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -776,12 +776,13 @@ sub sanitize_address
 	}
 
 	# if recipient_name is already quoted, do nothing
-	if ($recipient_name =~ /^(".*"|=\?utf-8\?q\?.*\?=)$/) {
+	if ($recipient_name =~ /^("[[:ascii:]]*"|=\?utf-8\?q\?.*\?=)$/) {
 		return $recipient;
 	}
 
 	# rfc2047 is needed if a non-ascii char is included
 	if ($recipient_name =~ /[^[:ascii:]]/) {
+		$recipient_name =~ s/^"(.*)"$/$1/;
 		$recipient_name = quote_rfc2047($recipient_name);
 	}
 
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 84238f7..192b97b 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -505,6 +505,19 @@ test_expect_success 'confirm doesnt loop forever' '
 	test $ret = "0"
 '
 
+test_expect_success 'utf8 Cc is rfc2047 encoded' '
+	clean_fake_sendmail &&
+	rm -fr outdir &&
+	git format-patch -1 -o outdir --cc="àéìöú <utf8@example.com>" &&
+	git send-email \
+	--from="Example <nobody@example.com>" \
+	--to=nobody@example.com \
+	--smtp-server="$(pwd)/fake.sendmail" \
+	outdir/*.patch &&
+	grep "^Cc:" msgtxt1 |
+	grep "=?utf-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= <utf8@example.com>"
+'
+
 test_expect_success '--compose adds MIME for utf8 body' '
 	clean_fake_sendmail &&
 	(echo "#!$SHELL_PATH" &&
-- 
1.6.2.1.427.g15408

^ permalink raw reply related	[relevance 63%]

* [PATCH] git-send-email: use compose-encoding for Subject
@ 2012-10-22 12:41 64% Krzysztof Mazur
  0 siblings, 0 replies; 200+ results
From: Krzysztof Mazur @ 2012-10-22 12:41 UTC (permalink / raw)
  To: gitster, git; +Cc: Krzysztof Mazur

The commit "git-send-email: introduce compose-encoding" introduced
the compose-encoding option to specify the introduction email encoding
(--compose option), but the email Subject encoding was still hardcoded
to UTF-8.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
---
Patch against km/send-email-compose-encoding
(commit 62e0069056ed11294c29bae25df69b6518f6339e). Cleanly applies to current
next (commit 291341ca77d902dc76e204a3fc498a155f0ab75d)

 git-send-email.perl   |  8 ++++----
 t/t9001-send-email.sh | 14 ++++++++++++++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 107e814..adcb4e3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -636,15 +636,15 @@ EOT
 	my $need_8bit_cte = file_has_nonascii($compose_filename);
 	my $in_body = 0;
 	my $summary_empty = 1;
+	if (!defined $compose_encoding) {
+		$compose_encoding = "UTF-8";
+	}
 	while(<$c>) {
 		next if m/^GIT:/;
 		if ($in_body) {
 			$summary_empty = 0 unless (/^\n$/);
 		} elsif (/^\n$/) {
 			$in_body = 1;
-			if (!defined $compose_encoding) {
-				$compose_encoding = "UTF-8";
-			}
 			if ($need_8bit_cte) {
 				print $c2 "MIME-Version: 1.0\n",
 					 "Content-Type: text/plain; ",
@@ -658,7 +658,7 @@ EOT
 			my $subject = $initial_subject;
 			$_ = "Subject: " .
 				($subject =~ /[^[:ascii:]]/ ?
-				 quote_rfc2047($subject) :
+				 quote_rfc2047($subject, $compose_encoding) :
 				 $subject) .
 				"\n";
 		} elsif (/^In-Reply-To:\s*(.+)\s*$/i) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 265ae04..89fceda 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -909,6 +909,20 @@ test_expect_success $PREREQ '--compose-encoding overrides sendemail.composeencod
 	grep "^Content-Type: text/plain; charset=iso-8859-2" msgtxt1
 '
 
+test_expect_success $PREREQ '--compose-encoding adds correct MIME for subject' '
+	clean_fake_sendmail &&
+	  GIT_EDITOR="\"$(pwd)/fake-editor\"" \
+	  git send-email \
+	  --compose-encoding iso-8859-2 \
+	  --compose --subject utf8-sübjëct \
+	  --from="Example <nobody@example.com>" \
+	  --to=nobody@example.com \
+	  --smtp-server="$(pwd)/fake.sendmail" \
+	  $patches &&
+	grep "^fake edit" msgtxt1 &&
+	grep "^Subject: =?iso-8859-2?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
+'
+
 test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '
 	echo master > master &&
 	git add master &&
-- 
1.8.0.2.g35080e9

^ permalink raw reply related	[relevance 64%]

* [PATCH v2 2/2] send-email: handle adjacent RFC 2047-encoded words properly
  2014-12-06 19:36 56% [PATCH v2 1/2] send-email: align RFC 2047 decoding more closely with the spec Роман Донченко
@ 2014-12-06 19:36 64% ` Роман Донченко
  0 siblings, 0 replies; 200+ results
From: Роман Донченко @ 2014-12-06 19:36 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Jay Soffian, Jeff King, Thomas Rast

The RFC says that they are to be concatenated after decoding (i.e. the
intervening whitespace is ignored).
---
 git-send-email.perl   | 26 ++++++++++++++++----------
 t/t9001-send-email.sh |  7 +++++++
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index d461ffb..7d5cc8a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -919,17 +919,23 @@ $time = time - scalar $#files;
 sub unquote_rfc2047 {
 	local ($_) = @_;
 	my $charset;
-	s{$re_encoded_word}{
-		$charset = $1;
-		my $encoding = $2;
-		my $text = $3;
-		if ($encoding eq 'q' || $encoding eq 'Q') {
-			$text =~ s/_/ /g;
-			$text =~ s/=([0-9A-F]{2})/chr(hex($1))/egi;
-			$text;
-		} else {
-			$&; # other encodings not supported yet
+	my $sep = qr/[ \t]+/;
+	s{$re_encoded_word(?:$sep$re_encoded_word)*}{
+		my @words = split $sep, $&;
+		foreach (@words) {
+			m/$re_encoded_word/;
+			$charset = $1;
+			my $encoding = $2;
+			my $text = $3;
+			if ($encoding eq 'q' || $encoding eq 'Q') {
+				$_ = $text;
+				s/_/ /g;
+				s/=([0-9A-F]{2})/chr(hex($1))/egi;
+			} else {
+				# other encodings not supported yet
+			}
 		}
+		join '', @words;
 	}eg;
 	return wantarray ? ($_, $charset) : $_;
 }
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 19a3ced..fa965ff 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -240,6 +240,13 @@ test_expect_success $PREREQ 'non-ascii self name is suppressed' "
 		'non_ascii_self_suppressed'
 "
 
+# This name is long enough to force format-patch to split it into multiple
+# encoded-words, assuming it uses UTF-8 with the "Q" encoding.
+test_expect_success $PREREQ 'long non-ascii self name is suppressed' "
+	test_suppress_self_quoted 'Ƒüñníęř €. Nâṁé' 'odd_?=mail@example.com' \
+		'long_non_ascii_self_suppressed'
+"
+
 test_expect_success $PREREQ 'sanitized self name is suppressed' "
 	test_suppress_self_unquoted '\"A U. Thor\"' 'author@example.com' \
 		'self_name_sanitized_suppressed'
-- 
2.1.1

^ permalink raw reply related	[relevance 64%]

* [PATCH 16/16] send-email: use Perl idioms in while loop
  @ 2010-09-30 13:43 64% ` Ævar Arnfjörð Bjarmason
  2010-09-30 13:42 62% ` [PATCH 04/16] send-email: get_patch_subject doesn't need a prototype Ævar Arnfjörð Bjarmason
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 200+ results
From: Ævar Arnfjörð Bjarmason @ 2010-09-30 13:43 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Thomas Rast, Ryan Anderson, Jay Soffian,
	Ævar Arnfjörð Bjarmason

Change `while(<$fh>) { my $c = $_' to `while(my $c = <$fh>) {', and
use `chomp $c' instead of `$c =~ s/\n$//g;', the two are equivalent in
this case.

I've also changed the --cccmd test so that we test for the stripping
of whitespace at the beginning of the lines returned from the
--cccmd. I think we probably shouldn't do this, but it was there
already so I haven't changed the behavior.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-send-email.perl   |    5 ++---
 t/t9001-send-email.sh |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 5a19d3d..445d2ec 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1252,10 +1252,9 @@ foreach my $t (@files) {
 	if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
 		open my $fh, "$cc_cmd \Q$t\E |"
 			or die "(cc-cmd) Could not execute '$cc_cmd'";
-		while(<$fh>) {
-			my $c = $_;
+		while(my $c = <$fh>) {
+			chomp $c;
 			$c =~ s/^\s*//g;
-			$c =~ s/\n$//g;
 			next if ($c eq $sender and $suppress_from);
 			push @cc, $c;
 			printf("(cc-cmd) Adding cc: %s from: '%s'\n",
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 6f67da4..99a16d5 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -204,7 +204,7 @@ test_expect_success $PREREQ 'Prompting works' '
 test_expect_success $PREREQ 'cccmd works' '
 	clean_fake_sendmail &&
 	cp $patches cccmd.patch &&
-	echo cccmd--cccmd@example.com >>cccmd.patch &&
+	echo "cccmd--  cccmd@example.com" >>cccmd.patch &&
 	{
 	  echo "#!$SHELL_PATH"
 	  echo sed -n -e s/^cccmd--//p \"\$1\"
-- 
1.7.3.159.g610493

^ permalink raw reply related	[relevance 64%]

* [PATCH v2 2/2] send-email: handle adjacent RFC 2047-encoded words properly
  2014-12-14 15:59 57% [PATCH v2 1/2] send-email: align RFC 2047 decoding more closely with the spec Роман Донченко
@ 2014-12-14 15:59 64% ` Роман Донченко
  0 siblings, 0 replies; 200+ results
From: Роман Донченко @ 2014-12-14 15:59 UTC (permalink / raw)
  To: gitster; +Cc: git

The RFC says that they are to be concatenated after decoding (i.e. the
intervening whitespace is ignored).

Signed-off-by: Роман Донченко <dpb@corrigendum.ru>
Acked-by: Jeff King <peff@peff.net>
---
 git-send-email.perl   | 26 ++++++++++++++++----------
 t/t9001-send-email.sh |  7 +++++++
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index d461ffb..7d5cc8a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -919,17 +919,23 @@ $time = time - scalar $#files;
 sub unquote_rfc2047 {
 	local ($_) = @_;
 	my $charset;
-	s{$re_encoded_word}{
-		$charset = $1;
-		my $encoding = $2;
-		my $text = $3;
-		if ($encoding eq 'q' || $encoding eq 'Q') {
-			$text =~ s/_/ /g;
-			$text =~ s/=([0-9A-F]{2})/chr(hex($1))/egi;
-			$text;
-		} else {
-			$&; # other encodings not supported yet
+	my $sep = qr/[ \t]+/;
+	s{$re_encoded_word(?:$sep$re_encoded_word)*}{
+		my @words = split $sep, $&;
+		foreach (@words) {
+			m/$re_encoded_word/;
+			$charset = $1;
+			my $encoding = $2;
+			my $text = $3;
+			if ($encoding eq 'q' || $encoding eq 'Q') {
+				$_ = $text;
+				s/_/ /g;
+				s/=([0-9A-F]{2})/chr(hex($1))/egi;
+			} else {
+				# other encodings not supported yet
+			}
 		}
+		join '', @words;
 	}eg;
 	return wantarray ? ($_, $charset) : $_;
 }
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 19a3ced..fa965ff 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -240,6 +240,13 @@ test_expect_success $PREREQ 'non-ascii self name is suppressed' "
 		'non_ascii_self_suppressed'
 "
 
+# This name is long enough to force format-patch to split it into multiple
+# encoded-words, assuming it uses UTF-8 with the "Q" encoding.
+test_expect_success $PREREQ 'long non-ascii self name is suppressed' "
+	test_suppress_self_quoted 'Ƒüñníęř €. Nâṁé' 'odd_?=mail@example.com' \
+		'long_non_ascii_self_suppressed'
+"
+
 test_expect_success $PREREQ 'sanitized self name is suppressed' "
 	test_suppress_self_unquoted '\"A U. Thor\"' 'author@example.com' \
 		'self_name_sanitized_suppressed'
-- 
2.1.1

^ permalink raw reply related	[relevance 64%]

* [PATCH] send-email: ensure quoted addresses are rfc2047 encoded
@ 2009-04-05  3:22 64% Jay Soffian
  0 siblings, 0 replies; 200+ results
From: Jay Soffian @ 2009-04-05  3:22 UTC (permalink / raw)
  To: git; +Cc: Jay Soffian

sanitize_address assumes that quoted addresses (e.g., "first last"
<first.last@example.com) do not need rfc2047 encoding, but this is
not always the case.

For example, various places in send-email extract addresses using
parse_address_line. parse_address_line returns the addresses already
quoted (e.g., "first last" <first.last@example.com), but not rfc2047
encoded.

This patch makes sanitize_address stricter about what needs rfc2047
encoding and adds a test demonstrating where I noticed the problem.
---
 git-send-email.perl   |    3 ++-
 t/t9001-send-email.sh |   13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index fc153f9..6bbdfec 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -776,12 +776,13 @@ sub sanitize_address
 	}
 
 	# if recipient_name is already quoted, do nothing
-	if ($recipient_name =~ /^(".*"|=\?utf-8\?q\?.*\?=)$/) {
+	if ($recipient_name =~ /^("[[:ascii:]]*"|=\?utf-8\?q\?.*\?=)$/) {
 		return $recipient;
 	}
 
 	# rfc2047 is needed if a non-ascii char is included
 	if ($recipient_name =~ /[^[:ascii:]]/) {
+		$recipient_name =~ s/^"(.*)"$/$1/;
 		$recipient_name = quote_rfc2047($recipient_name);
 	}
 
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 84238f7..192b97b 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -505,6 +505,19 @@ test_expect_success 'confirm doesnt loop forever' '
 	test $ret = "0"
 '
 
+test_expect_success 'utf8 Cc is rfc2047 encoded' '
+	clean_fake_sendmail &&
+	rm -fr outdir &&
+	git format-patch -1 -o outdir --cc="àéìöú <utf8@example.com>" &&
+	git send-email \
+	--from="Example <nobody@example.com>" \
+	--to=nobody@example.com \
+	--smtp-server="$(pwd)/fake.sendmail" \
+	outdir/*.patch &&
+	grep "^Cc:" msgtxt1 |
+	grep "=?utf-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= <utf8@example.com>"
+'
+
 test_expect_success '--compose adds MIME for utf8 body' '
 	clean_fake_sendmail &&
 	(echo "#!$SHELL_PATH" &&
-- 
1.6.2.1.427.g15408

^ permalink raw reply related	[relevance 64%]

* [PATCH 1/1] send-email: fix transferencoding config option
@ 2019-04-09 19:27 66% Heinrich Schuchardt
  0 siblings, 0 replies; 200+ results
From: Heinrich Schuchardt @ 2019-04-09 19:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Brian M Carlson, git, Heinrich Schuchardt

Since e67a228cd8a ("send-email: automatically determine transfer-encoding")
the value of sendmail.transferencoding is ignored because when parsing
the configuration $target_xfer_encoding is not initial anymore.

Instead of initializing variable $target_xfer_encoding on definition we
have to set it to the default value of 'auto' if is initial after parsing
the configuration files.

The documentation erroneously mentions the option as
sendmail.transferEncoding. Fix that typo.

Fixes: e67a228cd8a ("send-email: automatically determine transfer-encoding")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 Documentation/git-send-email.txt | 2 +-
 git-send-email.perl              | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 1afe9fc858..884e776add 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -146,7 +146,7 @@ Note that no attempts whatsoever are made to validate the encoding.
 	even more opaque.  auto will use 8bit when possible, and quoted-printable
 	otherwise.
 +
-Default is the value of the `sendemail.transferEncoding` configuration
+Default is the value of the `sendemail.transferencoding` configuration
 value; if that is unspecified, default to `auto`.

 --xmailer::
diff --git a/git-send-email.perl b/git-send-email.perl
index 8200d58cdc..0e23193939 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -239,7 +239,7 @@ sub do_edit {
 my (@suppress_cc);
 my ($auto_8bit_encoding);
 my ($compose_encoding);
-my $target_xfer_encoding = 'auto';
+my ($target_xfer_encoding);

 my ($debug_net_smtp) = 0;		# Net::SMTP, see send_message()

@@ -446,6 +446,8 @@ sub read_config {
 			$smtp_encryption = 'ssl';
 		}
 	}
+
+	$target_xfer_encoding = 'auto' unless (defined $target_xfer_encoding);
 }

 # read configuration from [sendemail "$identity"], fall back on [sendemail]
--
2.20.1


^ permalink raw reply related	[relevance 66%]

Results 1-200 of ~900   | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-04-09 19:27 66% [PATCH 1/1] send-email: fix transferencoding config option Heinrich Schuchardt
2012-10-22 12:41 64% [PATCH] git-send-email: use compose-encoding for Subject Krzysztof Mazur
2009-04-05  3:22 64% [PATCH] send-email: ensure quoted addresses are rfc2047 encoded Jay Soffian
2007-11-07  7:34 63% [PATCH] send-email: apply --suppress-from to S-o-b and cc-cmd Uwe Kleine-König
     [not found]     <7caf19ae394accab538d2f94953bb62b55a2c79f.1206486012.git.peff@peff.net>
2008-03-25 23:03 63% ` [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters Jeff King
2008-03-26  5:59       ` Teemu Likonen
2008-03-26  6:20 59%     ` Jeff King
2008-03-26  8:30           ` Teemu Likonen
2008-03-26  8:39 60%         ` Jeff King
2010-05-21 14:50 63% [PATCH] perl libs: perl -w + use warnings is redundant Ævar Arnfjörð Bjarmason
2010-05-21 16:52 60% ` [PATCH 1/2] " Ævar Arnfjörð Bjarmason
2012-05-17 13:16 62% [PATCH] send-email: support coloring dry-run output Nguyễn Thái Ngọc Duy
2007-06-11 17:04 62% [PATCH] Unquote From line from patch before comparing with given from address Kristian Høgsberg
2007-11-20  9:34 62% [PATCH] git-send-email: Don't add To: recipients to the Cc: header too Ask Bjørn Hansen
2006-10-06 20:24 62% Make git-send-email detect mbox-style patches more readily Matthew Wilcox
2007-11-19 11:00 62% [PATCH] Don't add To: recipients to the Cc: header Ask Bjørn Hansen
2007-08-07 13:12 61% [PATCH] send-email: don't add sender to Cc: if --suppress-from is given Uwe Kleine-König
2006-05-29  4:00 61% [PATCH] git-send-email.perl extract_valid_address issue Nicolas Troncoso Carrere
2012-07-30 19:25 61% [PATCH] send-email: improve RFC2047 quote parsing Thomas Rast
2008-03-25 23:02 61% [PATCH 1/2] send-email: specify content-type of --compose body Jeff King
2010-12-09  4:44 60% [PATCH] git-send-email: Accept -n as a synonym for --dry-run Alejandro R. Sedeño
2010-12-10 18:44 63% ` [PATCH 2/2] git-send-email: Add some short options Alejandro R. Sedeño
     [not found]     <AANLkTinsM5jdU194FR8L3hTvBXk0Tr_oV2E5752NOUpq@mail.gmail.com>
     [not found]     ` <AANLkTikkJNwF4LS9rx5=bHM2R0Pm751Y1u9V8iAt0w1A@mail.gmail.com>
     [not found]       ` <1285227413.7286.47.camel@Joe-Laptop>
     [not found]         ` <Pine.LNX.4.64.1009231054230.15528@ask.diku.dk>
     [not found]           ` <20100923090931.GA29789@albatros>
     [not found]             ` <20100923120024.GA26715@albatros>
     [not found]               ` <1285253867.31572.13.camel@Joe-Laptop>
     [not found]                 ` <Pine.LNX.4.64.1009231757090.11585@ask.diku.dk>
2010-09-23 17:17                   ` [RFC PATCH] sit-send-email.pl: Add --to-cmd Joe Perches
2010-09-23 17:29                     ` Ævar Arnfjörð Bjarmason
2010-09-23 17:46                       ` Joe Perches
2010-09-23 17:50                         ` Ævar Arnfjörð Bjarmason
2010-09-23 18:45                           ` [PATCH V2] git-send-email.perl: " Joe Perches
2010-09-23 22:37                             ` Junio C Hamano
2010-09-24  1:18 60%                           ` [PATCH V3] " Joe Perches
2010-09-24 15:32                                 ` Jakub Narebski
2010-09-24 16:06                                   ` Joe Perches
2010-09-24 16:47                                     ` Ævar Arnfjörð Bjarmason
2010-09-24 17:03 60%                                   ` [PATCH V4] " Joe Perches
2009-01-08 13:50 60% [PATCH] allow 8bit data in email body sent by send-email Andre Przywara
2006-07-09  6:17 60% [RFC+PATCH 1/1] Move SCM interoperability tools into scm/ Ryan Anderson
2013-06-18 12:49 60% [PATCH 1/2] send-email: sanitize author when writing From line Michael S. Tsirkin
2010-09-14 19:02 60% [PATCH] send-email: use catfile() to concatenate files Ævar Arnfjörð Bjarmason
2023-08-10  0:39 60% [PATCH] Fix bug when more than one readline instance is used Wesley Schwengle
2011-09-20  8:29 59% [PATCH] send-email: Honor multi-part email messages Alexey Shumkin
2014-11-23 23:50 59% [PATCH] send-email: handle adjacent RFC 2047-encoded words properly Роман Донченко
2007-07-10 17:02 59% [PATCH] send-email: extend sanitize_address_rfc822 to do rfc2047 quoting Uwe Kleine-König
2007-07-10 17:02 62% ` [PATCH] [RFC] send-email: honor --suppress-from --signed-off-cc Uwe Kleine-König
2011-09-16 22:32 59% [PATCH] send-email: Honor multi-part email messages Alexey Shumkin
2008-07-25 13:06 59% [PATCH] Avoid warning when From: is encoded Peter Valdemar Mørch
2013-06-20 12:27 59% [PATCH v2 1/2] send-email: sanitize author when writing From line Michael S. Tsirkin
2007-10-01 12:42 58% [PATCH] git-send-email: add a new sendemail.to configuration variable Miklos Vajna
2023-11-06 15:32 57% Regression: git send-email Message-Id: numbering doesn't start at 1 any more Uwe Kleine-König
2014-12-14 15:59 57% [PATCH v2 1/2] send-email: align RFC 2047 decoding more closely with the spec Роман Донченко
2014-12-14 15:59 64% ` [PATCH v2 2/2] send-email: handle adjacent RFC 2047-encoded words properly Роман Донченко
2009-04-22 13:41 56% [PATCH] Add parsing of elm aliases to git-send-email Bill Pemberton
2007-08-05 20:09 56% [PATCH] send-email: let sanitize_address_rfc822 do rfc2047 quoting Uwe Kleine-König
2008-03-17 22:53 56% [PATCH] Shorten and simplify sendemail.alias* configuration variables Xavier Maillard
2014-12-06 19:36 56% [PATCH v2 1/2] send-email: align RFC 2047 decoding more closely with the spec Роман Донченко
2014-12-06 19:36 64% ` [PATCH v2 2/2] send-email: handle adjacent RFC 2047-encoded words properly Роман Донченко
2017-11-18 12:42 56% [PATCH] git-send-email: honor $PATH Florian Klink
2012-04-07  0:29 55% [PATCH] send-email: make annotate configurable Felipe Contreras
2009-03-01  8:23 55% [PATCH] send-email: add --confirm option Jay Soffian
2009-11-26 19:04 54% [PATCH] send-email: automatic envelope sender Felipe Contreras
2021-03-23 16:27 54% [PATCH v2] git-send-email: Respect core.hooksPath setting Robert Foss
2011-02-06 14:44 54% [PATCH] send-email: add 'specify-author' option Felipe Contreras
2012-10-24  8:03 54% [PATCH] git-send-email: skip RFC2047 quoting for ASCII subjects Krzysztof Mazur
2021-04-09 21:18 53% [PATCH] send-email: clarify SMTP encryption settings Drew DeVault
2007-03-19  1:37 53% [PATCH] Make git-send-email aware of Cc: lines J. Bruce Fields
2012-04-06 12:21 53% [PATCH RESEND] send-email: add 'specify-author' option Felipe Contreras
2022-11-09 18:23 53% [PATCH] Change git-send-email's sendemail-validate hook to use header information Strawbridge, Michael
2013-11-09 10:21 53% [PATCH] git-send-email: Added the ability to query the number of smtp password questions silvio
2013-11-10 11:56     ` [PATCH v2] git-send-mail: ask smtp password several times silvio
2013-11-10 11:56 52%   ` [[PATCH v2]] git-send-email: Added the ability to query the number of smtp password questions silvio
     [not found]     <11489310153730-git-send-email-1>
     [not found]     ` <11489310153598-git-send-email-1>
     [not found]       ` <11489310151293-git-send-email-1>
     [not found]         ` <11489310153617-git-send-email-1>
2006-05-30  5:57           ` [PATCH 4/4] Add a basic test case for git send-email, and fix some real bugs discovered Junio C Hamano
2006-05-30  6:45 53%         ` Junio C Hamano
2023-11-14 16:38 53% [PATCH] send-email: avoid duplicate specification warnings Todd Zullinger
2018-10-18 21:15 52% [PATCH] send-email: explicitly disable authentication Joshua Watt
2019-07-30 16:26 52% [PATCHv2] send-email: Ask if a patch should be sent twice Dmitry Safonov
2019-07-30 20:33 52% [PATCHv3] " Dmitry Safonov
2021-08-24 11:41 52% [RFC PATCH] send-email: allow fixing the cover letter subject Carlo Marcelo Arenas Belón
2015-05-22  3:35 52% [PATCH v3] send-email: Add simple email aliases format Allen Hubbe
2011-08-06  0:40 52% [PATCH] git-send-email: Add AUTH LOGIN support Joe Perches
2012-10-03 22:05 52% [PATCH 1/2] git-send-email: introduce compose-encoding Krzysztof Mazur
2012-10-03 22:05     ` [PATCH 2/2] git-send-email: use locale encoding for compose Krzysztof Mazur
2012-10-09 21:34       ` Junio C Hamano
2012-10-09 23:02 60%     ` Krzysztof Mazur
2022-11-24  2:00 52% [PATCH] send-email: disable option auto-abbreviation Kyle Meyer
2015-03-06 21:59 52% [PATCH] send-email: Add CCs from additional commit tags Soren Brinkmann
2007-06-16 14:00 52% [PATCH] Add --skip-from-cc option to git-send-email to prevent mailing to From: and Cc: addresses in patch headers Alex Unleashed, Alex Unleashed
2015-05-22  0:16 52% [PATCH v2] send-email: Add simple email aliases format Allen Hubbe
2014-03-24 21:38 52% [RFC][PATCH] send-email: add --[no-]xmailer option Luis Henriques
2014-12-03 17:08     ` Junio C Hamano
2014-12-03 17:23 53%   ` Junio C Hamano
2009-02-19  1:00 51% [PATCH] send-email: Add config option for sender address Trent Piepho
2007-12-08 17:12 51% [PATCH] send-email: Allow sleeping between sending mails Dan Nicholson
2017-05-18 11:35 51% [PATCH] send-email: Add tocmd option to suppress-cc Viresh Kumar
2020-05-01 10:51 51% [PATCH] send-email: Defines smtpPassCmd config option Leonardo Bras
2019-07-30 21:24 51% [PATCHv4] send-email: Ask if a patch should be sent twice Dmitry Safonov
2008-02-21  9:29     git-send-email getting filtered as spam by vger.kernel.org Len Brown
2008-02-21 12:21     ` Len Brown
2008-02-21 20:51       ` Uwe Kleine-König
2008-02-21 21:14 59%     ` Junio C Hamano
2021-04-11 12:54     [PATCH v2 0/3] git-send-email: improve SSL configuration Drew DeVault
2021-04-11 12:54 56% ` [PATCH v2 2/3] git-send-email: die on invalid smtp_encryption Drew DeVault
2021-04-11 12:54 51% ` [PATCH v2 3/3] git-send-email: rename 'tls' to 'starttls' Drew DeVault
2007-08-06  8:33     [PATCH] send-email: let sanitize_address_rfc822 do rfc2047 quoting Uwe Kleine-König
2007-08-06 20:34 55% ` [PATCH] send-email: teach sanitize_address to " Uwe Kleine-König
2006-07-10  4:54     [RFC+PATCH 0/2] Clean up root directory Ryan Anderson
2006-07-10  4:54 59% ` [PATCH 1/2] Move SCM interoperability tools into interop/ Ryan Anderson
2010-09-04 19:55     [PATCH v2 0/3] Add support for SMTP server options Pascal Obry
2010-09-04 19:55 51% ` [PATCH v2 3/3] New send-email option smtpserveroption Pascal Obry
2013-04-07 17:46     [PATCH v4 0/6] send-email: configuration improvements Felipe Contreras
2013-04-07 17:46 52% ` [PATCH v4 1/6] send-email: make annotate configurable Felipe Contreras
2021-10-11 13:46     [PATCH v7 0/3] send-email: shell completion improvements Ævar Arnfjörð Bjarmason
2021-10-25 21:27 53% ` [PATCH v8 2/2] send-email docs: add format-patch options Thiago Perrotta
2022-11-11  2:15     [PATCH 0/2] Expose header information to git-send-email's sendemail-validate hook Strawbridge, Michael
2022-11-11  2:15 52% ` [PATCH 1/2] " Strawbridge, Michael
2022-11-11 19:30     [PATCH v2 0/2] Update sendemail-validate hook docs to add header file parameter Strawbridge, Michael
2022-11-11 19:30 52% ` [PATCH v2 1/2] Expose header information to git-send-email's sendemail-validate hook Strawbridge, Michael
2017-11-18 21:28     [PATCH] git-send-email: honor $PATH Florian Klink
2017-11-18 22:20 55% ` [PATCH v2] git-send-email: honor $PATH for sendmail binary Florian Klink
2023-11-15 17:39     [RFC PATCH v2 0/2] send-email: avoid duplicate specification warnings Todd Zullinger
2023-11-15 17:39 61% ` [RFC PATCH v2 2/2] send-email: remove stray characters from usage Todd Zullinger
2023-01-10 21:16     [PATCH v5 0/2] send-email: expose header information to git-send-email's sendemail-validate hook Strawbridge, Michael
2023-01-10 21:16 55% ` [PATCH v5 2/2] " Strawbridge, Michael
2024-05-21 19:56     [PATCH 00/12] Fix various overly aggressive protections in 2.45.1 and friends Junio C Hamano
2024-05-21 19:56 59% ` [PATCH 02/12] send-email: avoid creating more than one Term::ReadLine object Junio C Hamano
2024-05-21 19:56 53% ` [PATCH 01/12] send-email: drop FakeTerm hack Junio C Hamano
2007-01-10 18:33     [PATCH] Provide better feedback for the untracked only case in status output Juergen Ruehle
2007-01-10 20:07 62% ` [PATCH] Quick hack to avoid double qp encoding Juergen Ruehle
2021-03-11  2:10     [PATCH v8 00/37] config-based hooks Emily Shaffer
2021-03-11  2:10 51% ` [PATCH v8 35/37] git-send-email: use 'git hook run' for 'sendemail-validate' Emily Shaffer
2007-12-21  6:01     [PATCH] git-send-email: Add --suppress-all-from option David Brown
2007-12-24 19:01     ` [PATCH] git-send-email: Generalize auto-cc recipient mechanism David Brown
2007-12-24 21:03       ` Joel Becker
2007-12-24 21:26 54%     ` [PATCH] git-send-email: Add --suppress-cc all David Brown
2012-06-11  7:32     How can I specify the "sendmail" program for git-send-email? Richard Yang
2012-06-11  8:23     ` Erik Faye-Lund
2012-06-11  9:04       ` Richard Yang
2012-06-11  9:15 61%     ` Erik Faye-Lund
2008-01-18 14:16     [PATCH] git-send-email.perl: check for lines longer than 998 characters Jeff King
2008-01-18 14:20 51% ` [PATCH 3/3] send-email: add no-validate option Jeff King
2011-04-29 17:51     [PATCH 0/6] gitweb: Improve ctags, introduce categories Jakub Narebski
2011-04-30 20:36     ` Øyvind A. Holm
2011-05-03 14:02       ` git-send-email and non 7bit clean message (was: [PATCH 0/6] gitweb: Improve ctags, introduce categories) Jakub Narebski
2011-05-04 13:50 58%     ` [PATCH/RFC] git-send-email: Do not encode Subject if not required (was: git-send-email and non 7bit clean message) Jakub Narebski
2009-10-20 22:12     git-send-email.perl defect: address missing trailing > accepted Joe Perches
2009-10-20 22:29 62% ` Erik Faye-Lund
2007-11-19  8:17     [PATCH v2] git-send-email: show all headers when sending mail Junio C Hamano
2007-11-19 10:48 62% ` [PATCH] Don't print an empty Cc header in SMTP mode when there's no cc recipient defined Ask Bjørn Hansen
2008-09-29  0:36     [PATCH 3/8] Docs: send-email: Man page option ordering Jeff King
2008-09-29  5:08     ` [RFC 6/9] Docs: send-email: Remove unnecessary config variable description Michael Witten
2008-09-29  5:08 53%   ` [RFC 7/9] send-email: Completely replace --signed-off-cc with --signed-off-by-cc Michael Witten
2006-10-29 19:31     [PATCH 1/2] git-send-email: Document support for local sendmail instead of SMTP server Sergey Vlasov
2006-10-29 19:31 55% ` [PATCH 2/2] git-send-email: Read the default SMTP server from the GIT config file Sergey Vlasov
2008-01-17 15:32     [BUG] git send-email brakes patches with very long lines Jeff King
2008-01-18  7:47 61% ` [PATCH] git-send-email.perl: check for lines longer than 998 characters Adam Piątyszek
2011-09-29 15:01     [PATCH v4] send-email: auth plain/login fix Joe Perches
2011-09-29 17:02 57% ` [PATCH] " Zbigniew Jędrzejewski-Szmek
2010-05-26  6:04     Apology/Bug report: git-send-email sends everything on Ctrl+C Sam Vilain
2010-05-26  6:50     ` Sam Vilain
2010-05-26  8:05       ` Will Palmer
2010-05-26  8:51         ` Sam Vilain
2010-05-26  9:07           ` Sverre Rabbelier
2010-05-26  9:16             ` Michael J Gruber
2010-05-26  9:27 53%           ` Sam Vilain
2007-11-10  0:14     `git-send-email' doesn't specify `Content-Type' Ludovic Courtès
2007-11-10  0:52     ` Johannes Schindelin
2007-11-10 10:14       ` Brian Swetland
2007-11-10 12:25         ` Björn Steinbrink
2007-11-10 12:35           ` Brian Swetland
2007-11-10 12:51             ` Björn Steinbrink
2007-11-11  8:32 53%           ` Jeff King
2011-09-28 22:00     [PATCH v3] send-email: auth plain/login fix Junio C Hamano
2011-09-29 14:16 58% ` [PATCH v4] " Zbigniew Jędrzejewski-Szmek
2023-01-17  1:37     [PATCH v5 0/2] send-email: expose header information to git-send-email's sendemail-validate hook Strawbridge, Michael
2023-01-17  1:37 55% ` [PATCH v5 2/2] " Strawbridge, Michael
2008-09-29 17:44     [RFC2 9/9] send-email: signedoffcc -> signedoffbycc, but handle both Jeff King
2008-09-30 12:58     ` [PATCH 1/9] Docs: send-email's usage text and man page mention same options Michael Witten
2008-09-30 12:58       ` [PATCH 2/9] Docs: send-email usage text much sexier Michael Witten
2008-09-30 12:58         ` [PATCH 3/9] Docs: send-email: Man page option ordering Michael Witten
2008-09-30 12:58 52%       ` [PATCH 4/9] send-email: change --no-validate to boolean --[no-]validate Michael Witten
2008-09-30 12:58             ` [PATCH 5/9] Docs: send-email: --chain_reply_to -> --[no-]chain-reply-to Michael Witten
2008-09-30 12:58               ` [PATCH 6/9] Docs: send-email: Remove unnecessary config variable description Michael Witten
2008-09-30 12:58                 ` [PATCH 7/9] Docs: send-email: Create logical groupings for --help text Michael Witten
2008-09-30 12:58                   ` [PATCH 8/9] Docs: send-email: Create logical groupings for man text Michael Witten
2008-09-30 12:58 53%                 ` [PATCH 9/9] send-email: signedoffcc -> signedoffbycc, but handle both Michael Witten
2012-07-28 21:33     bug (?) in send email Christoph Miebach
2012-07-30 10:38     ` Christoph Miebach
2012-07-30 12:30 60%   ` Thomas Rast
2017-06-07  5:47     send-email: Net::SMTP::SSL failure Liam Breck
2017-06-07 17:00     ` Liam Breck
2017-06-07 17:16       ` Ævar Arnfjörð Bjarmason
2017-06-07 18:04         ` Liam Breck
2017-06-07 19:30 56%       ` Ævar Arnfjörð Bjarmason
2009-06-09  7:05     [PATCH 1/6] send-email: fix a typo in a comment Markus Heidelberg
2009-06-09  7:11 52% ` [PATCH 2/2] send-email: fix non-threaded mails Markus Heidelberg
2010-03-22 14:59     [REGRESSION] git var GIT_EDITOR fails without tty Uwe Kleine-König
2010-03-22 16:12 61% ` [PATCH] send-email: lazily assign editor variable Michael J Gruber
2010-03-22 23:25 57% ` [PATCH] send-email: do not check for editor until needed Jonathan Nieder
2007-04-26  2:37     git-send-email fixes, cleanups and improvements Robin H. Johnson
2007-04-26  2:37     ` [PATCH 1/9] Document --dry-run parameter to send-email Robin H. Johnson
2007-04-26  2:37       ` [PATCH 2/9] Prefix Dry- to the message status to denote dry-runs Robin H. Johnson
2007-04-26  2:37         ` [PATCH 3/9] Debugging cleanup improvements Robin H. Johnson
2007-04-26  2:37           ` [PATCH 4/9] Change the scope of the $cc variable as it is not needed outside of send_message Robin H. Johnson
2007-04-26  2:37             ` [PATCH 5/9] Perform correct quoting of recipient names Robin H. Johnson
2007-04-26  4:15               ` Junio C Hamano
2007-04-26  4:41                 ` Robin H. Johnson
2007-04-26  4:53 62%               ` [PATCH 10/9] Sanitize @to recipients Robin H. Johnson
2009-03-31 16:22     [PATCH 0/4] send-email: correct various issues Jay Soffian
2009-03-31 16:22     ` [PATCH 1/4] send-email: don't attempt to prompt if tty is closed Jay Soffian
2009-03-31 16:22       ` [PATCH 2/4] send-email: ask_default should apply to all emails, not just the first Jay Soffian
2009-03-31 16:22         ` [PATCH 3/4] send-email: correct two tests which were going interactive Jay Soffian
2009-03-31 16:22 63%       ` [PATCH 4/4] send-email: ensure quoted addresses are rfc2047 encoded Jay Soffian
2008-04-09  1:29     [PATCH 0/8] Fix git's test suite to pass when the path contains spaces Bryan Donlan
2008-04-10  6:50     ` [PATCH v2 00/10] " Bryan Donlan
2008-05-04  5:37       ` [PATCH v3 " Bryan Donlan
2008-05-04  5:37         ` [PATCH v3 01/10] git-rebase.sh: Fix --merge --abort failures when path contains whitespace Bryan Donlan
2008-05-04  5:37           ` [PATCH v3 02/10] config.c: Escape backslashes in section names properly Bryan Donlan
2008-05-04  5:37 52%         ` [PATCH v3 03/10] git-send-email.perl: Handle shell metacharacters in $EDITOR properly Bryan Donlan
2008-04-10  6:50       ` [PATCH v2 01/10] git-rebase.sh: Fix --merge --abort failures when path contains whitespace Bryan Donlan
2008-04-10  6:50         ` [PATCH v2 02/10] config.c: Escape backslashes in section names properly Bryan Donlan
2008-04-10  6:50 51%       ` [PATCH v2 03/10] git-send-email.perl: Handle shell metacharacters in $EDITOR properly Bryan Donlan
2008-04-09  1:29     ` [PATCH 1/8] git-rebase.sh: Fix --merge --abort failures when path contains whitespace Bryan Donlan
2008-04-09  1:29       ` [PATCH 2/8] config.c: Escape backslashes in section names properly Bryan Donlan
2008-04-09  1:29 54%     ` [PATCH 3/8] git-send-email.perl: Handle shell metacharacters in $EDITOR properly Bryan Donlan
2022-04-21 19:58     Should sendemail.confirm default to always? Ævar Arnfjörð Bjarmason
2022-04-22  8:36 52% ` [PATCH] send-email: always confirm by default Alyssa Ross
2008-10-31 10:57     git send-email improvements Pierre Habouzit
2008-10-31 10:57     ` [PATCH 1/3] git send-email: avoid leaking directory file descriptors Pierre Habouzit
2008-10-31 10:57 55%   ` [PATCH 2/3] git send-email: interpret unknown files as revision lists Pierre Habouzit
2008-11-04 16:24     ` [take 2] git send-email updates Pierre Habouzit
2008-11-04 16:24       ` [PATCH 1/5] git send-email: make the message file name more specific Pierre Habouzit
2008-11-04 16:24 52%     ` [PATCH 2/5] git send-email: interpret unknown files as revision lists Pierre Habouzit
2007-07-13  4:17     [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present Greg KH
2007-08-09 12:28 57% ` Uwe Kleine-König
2023-01-17 14:27     [PATCH v7 0/2] send-email: expose header information to git-send-email's sendemail-validate hook Strawbridge, Michael
2023-01-17 14:27 53% ` [PATCH v7 2/2] " Strawbridge, Michael
2007-11-15 10:57     [BUG] encoding problem with format-patch + send-email Uwe Kleine-König
2007-11-16 10:49     ` Jeff King
2007-11-17  0:48       ` Junio C Hamano
2007-11-19 10:49         ` Uwe Kleine-König
2007-11-20 12:54 59%       ` [PATCH] send-email: add transfer encoding header with content-type Jeff King
2013-04-07  7:10     [PATCH v3 0/4] send-email: couple of improvements Felipe Contreras
2013-04-07  7:10 52% ` [PATCH v3 1/4] send-email: make annotate configurable Felipe Contreras
2009-06-07 21:40     [PATCH 0/6] fixes for git-send-email Markus Heidelberg
2009-06-07 21:40 53% ` [PATCH 3/6] send-email: fix threaded mails without chain-reply-to Markus Heidelberg
2009-06-10  5:51       ` Junio C Hamano
2009-06-10  7:16 52%     ` [PATCH 2/6] send-email: fix non-threaded mails Junio C Hamano
2009-06-07 21:40 51% ` [PATCH 5/6] " Markus Heidelberg
2010-06-12 10:11     vger doesn't like UTF-8 from send-email Thomas Rast
2010-06-12 15:06 56% ` [PATCH] send-email: ask about and declare 8bit mails Thomas Rast
2013-01-25 15:28     [PATCH resent] send-email: Honor multi-part email messages Alexey Shumkin
2013-01-25 15:28 59% ` [PATCH] " Alexey Shumkin
2011-09-26 17:24     [PATCH] send-email: auth plain/login fix Jakub Narebski
2011-09-27 21:36 52% ` [PATCH v2] " Zbigniew Jędrzejewski-Szmek
2011-09-28 10:26 51% ` [PATCH v3] " Zbigniew Jędrzejewski-Szmek
2019-05-26 17:22     [PATCH] send-email: remove documented requirement for Net::SMTP::SSL Chris Mayo
2019-05-27 19:35     ` Eric Wong
2019-05-28  0:05 57%   ` Todd Zullinger
2013-01-29 19:53     [PATCH] git-send-email: add ~/.authinfo parsing Junio C Hamano
2013-01-29 21:08 54% ` [PATCHv2] " Michal Nazarewicz
2023-11-16  4:59     [RFC PATCH v2 2/2] send-email: remove stray characters from usage Junio C Hamano
2023-11-16 19:36 62% ` [PATCH] " Todd Zullinger
2010-09-05 17:48     [PATCH v3 0/3] Add support for SMTP server options Pascal Obry
2010-09-05 17:49 51% ` [PATCH v3 3/3] New send-email option smtpserveroption Pascal Obry
2023-01-17  1:39     [PATCH v6 0/2] send-email: expose header information to git-send-email's sendemail-validate hook Strawbridge, Michael
2023-01-17  1:39 53% ` [PATCH v6 2/2] " Strawbridge, Michael
2008-03-28 21:27     [ANNOUNCE] GIT 1.5.5-rc2 Jeff King
2008-03-28 21:29 63% ` [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters Jeff King
2008-03-28 21:28 61% ` [PATCH 1/2] send-email: specify content-type of --compose body Jeff King
2008-09-28  1:09     [PATCH 1/8] Docs: send-email's usage text and man page mention same options Michael Witten
2008-09-28  1:09     ` [PATCH 2/8] Docs: send-email usage text much sexier Michael Witten
2008-09-28  1:09       ` [PATCH 3/8] Docs: send-email: Man page option ordering Michael Witten
2008-09-28  1:09 52%     ` [PATCH 4/8] send-email: change --no-validate to boolean --[no-]validate Michael Witten
2010-09-30 13:42     [PATCH 00/16] git-send-email cleanups Ævar Arnfjörð Bjarmason
2010-09-30 13:43 64% ` [PATCH 16/16] send-email: use Perl idioms in while loop Ævar Arnfjörð Bjarmason
2010-09-30 13:42 62% ` [PATCH 04/16] send-email: get_patch_subject doesn't need a prototype Ævar Arnfjörð Bjarmason
2010-09-30 13:42 62% ` [PATCH 05/16] send-email: file_declares_8bit_cte " Ævar Arnfjörð Bjarmason
2010-09-30 13:43 62% ` [PATCH 09/16] send-email: sanitize_address use $foo, not "$foo" Ævar Arnfjörð Bjarmason
2010-09-30 13:43 62% ` [PATCH 11/16] send-email: use (?:) instead of () if no match variables are needed Ævar Arnfjörð Bjarmason
2010-09-30 13:42 62% ` [PATCH 01/16] send-email: use lexical filehandle for opendir Ævar Arnfjörð Bjarmason
2010-09-30 13:42 62% ` [PATCH 06/16] send-email: unique_email_list doesn't need a prototype Ævar Arnfjörð Bjarmason
2010-09-30 13:43 62% ` [PATCH 12/16] send-email: is_rfc2047_quoted use qr// regexes Ævar Arnfjörð Bjarmason
2010-09-30 13:43 62% ` [PATCH 10/16] send-email: sanitize_address use qq["foo"], not "\"foo\"" Ævar Arnfjörð Bjarmason
2010-09-30 13:43 62% ` [PATCH 14/16] send-email: send_message die on $!, not $? Ævar Arnfjörð Bjarmason
2010-09-30 13:43 62% ` [PATCH 07/16] send-email: cleanup_compose_files doesn't need a prototype Ævar Arnfjörð Bjarmason
2010-09-30 13:43 61% ` [PATCH 08/16] send-email: use \E***\Q instead of \*\*\* Ævar Arnfjörð Bjarmason
2010-09-30 13:43 61% ` [PATCH 15/16] send-email: make_message_id use "require" instead of "use" Ævar Arnfjörð Bjarmason
2010-09-30 13:43 60% ` [PATCH 13/16] send-email: extract_valid_address use qr// regexes and /o Ævar Arnfjörð Bjarmason
2010-09-30 19:03 62%   ` [PATCH v2 13/16] send-email: extract_valid_address use qr// regexes Ævar Arnfjörð Bjarmason
2010-09-30 13:42 58% ` [PATCH 03/16] send-email: use lexical filehandles during sending Ævar Arnfjörð Bjarmason
2010-09-30 13:42 57% ` [PATCH 02/16] send-email: use lexical filehandles for $compose Ævar Arnfjörð Bjarmason
2018-07-06  2:23     [PATCH 0/3] Automatic transfer encoding for patches brian m. carlson
2018-07-06  2:23 54% ` [PATCH 2/3] send-email: accept long lines with suitable transfer encoding brian m. carlson
2018-07-08 22:17     ` [PATCH v2 0/4] Automatic transfer encoding for patches brian m. carlson
2018-07-08 22:17 52%   ` [PATCH v2 2/4] send-email: accept long lines with suitable transfer encoding brian m. carlson
2009-06-12 10:49     [PATCH 0/6] send-email threading fixes Markus Heidelberg
2009-06-12 10:51 52% ` [PATCH 5/6] send-email: fix threaded mails without chain-reply-to Markus Heidelberg
2009-06-12 10:51 51% ` [PATCH 2/6] send-email: fix non-threaded mails Markus Heidelberg
2010-05-29 22:45     [PATCH/RFC 0/5] Add internationalization support to Git Ævar Arnfjörð Bjarmason
2010-05-30 20:54 56% ` [PATCH/RFC v2 5/6] gettext: Add a Gettext interface for Perl Ævar Arnfjörð Bjarmason
2010-06-01 23:39 55% ` [PATCH/RFC v3 3/7] " Ævar Arnfjörð Bjarmason
2023-01-06 21:50     [PATCH v4 0/1] Expose header information to git-send-email's sendemail-validate hook Strawbridge, Michael
2023-01-06 21:51 54% ` [PATCH v4 1/1] " Strawbridge, Michael
2010-09-04 16:06     [PATCH 0/2] Add support for SMTP server options Pascal Obry
2010-09-04 16:06 52% ` [PATCH 2/2] New send-email option smtpserveroptions Pascal Obry
2019-05-08 10:13     Re* [PATCH 1/1] send-email: fix transferencoding config option Junio C Hamano
2019-05-08 10:56 60% ` [PATCH v2 2/2] send-email: honor transferencoding config option again Junio C Hamano
2019-05-08 10:56 56% ` [PATCH v2 1/2] send-email: update the mechanism to set default configuration values Junio C Hamano
2009-10-28 15:21     packaging vs default pager Ben Walton
2009-10-28 17:55     ` Junio C Hamano
2009-10-29  7:32       ` [PATCH 0/2] " Jonathan Nieder
2009-10-29  7:50         ` [PATCH/RFC 2/2] Provide a build time default-editor setting Jonathan Nieder
2009-10-29 20:43           ` Junio C Hamano
2009-10-30 10:16             ` [PATCH v2 0/8] Default pager and editor Jonathan Nieder
2009-10-30 10:32 51%           ` [PATCH 5/8] add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR" Jonathan Nieder
2009-10-31  1:20               ` [PATCH v3 0/8] Default pager and editor Jonathan Nieder
2009-10-31  1:42 51%             ` [PATCH 5/8] add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR" Jonathan Nieder
2009-11-11 23:51                 ` [PATCH v4 0/9] Default pager and editor Jonathan Nieder
2009-11-12  0:02 51%               ` [PATCH 6/9] add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR" Jonathan Nieder
2021-05-11 19:24     [PATCH v3] git-send-email: use ! to indicate relative path to command Jeff King
2021-05-11 20:40 52% ` [PATCH v4] " Gregory Anders
2023-11-16 19:30     [PATCH v3 0/2] send-email: avoid duplicate specification warnings Todd Zullinger
2023-11-16 19:30 52% ` [PATCH v3 1/2] perl: bump the required Perl version to 5.8.1 from 5.8.0 Todd Zullinger
2009-04-18 17:01     [PATCH RFC3.5 00/12] Introduction to Decreasing send-email Entropy Michael Witten
2009-04-18 17:01     ` [PATCH RFC3.5 01/12] send-email: Cleanup the usage text and docs a bit Michael Witten
2009-04-18 17:01       ` [PATCH RFC3.5 02/12] send-email: No longer repeatedly test if $smtp_server is a command Michael Witten
2009-04-18 17:01 57%     ` [PATCH RFC3.5 03/12] send-email: Interpret --smtp-server "" as "use a default" Michael Witten
2009-04-19  0:13     Michael Witten
2009-04-19 14:16 56% ` [PATCH RFC3.5.1 " Michael Witten
2008-09-22 15:58     [PATCH RFC 1/6] Docs: send-email's usage text and man page mention same options Michael Witten
2008-09-22 15:58     ` [PATCH RFC 2/6] Docs: send-email usage cleanup 1 Michael Witten
2008-09-22 15:58       ` [PATCH RFC 3/6] Docs: send-email usage text much sexier Michael Witten
2008-09-22 15:58         ` [PATCH RFC 4/6] Docs: send-email: Option order the same in man page and usage text Michael Witten
2008-09-22 15:58 53%       ` [PATCH RFC 5/6] Docs: send-email: change --no-validate to boolean --[no-]validate Michael Witten
2008-09-25 20:44     ` [PATCH RFC 1/6] Docs: send-email's usage text and man page mention same options Michael Witten
2008-09-25 20:44       ` [PATCH RFC 2/6] Docs: send-email usage cleanup 1 Michael Witten
2008-09-25 20:44         ` [PATCH RFC 3/6] Docs: send-email usage text much sexier Michael Witten
2008-09-25 20:44           ` [PATCH RFC 4/6] Docs: send-email: Option order the same in man page and usage text Michael Witten
2008-09-25 20:44 52%         ` [PATCH RFC 5/6] Docs: send-email: change --no-validate to boolean --[no-]validate Michael Witten
2015-11-15 20:22     [PATCH v2 1/2] sendemail: teach git-send-email to list aliases Jacob Keller
2015-11-16 23:30     ` Eric Sunshine
2015-11-16 23:40       ` Keller, Jacob E
2015-11-16 23:50         ` Eric Sunshine
2015-11-17  0:10           ` Keller, Jacob E
2015-11-17  7:20 54%         ` Eric Sunshine
2006-02-13  8:22     [PATCH 1/2] send-email: Add some options for controlling how addresses are automatically Ryan Anderson
2006-02-13  8:22 54% ` [PATCH 2/2] send-email: Add --cc Ryan Anderson
2009-04-13 18:23     [PATCH RFC3 INTRO] I hope this will do it! Michael Witten
2009-04-13 18:23     ` [PATCH RFC3 01/13] Docs: send-email: Put options back into alphabetical order Michael Witten
2009-04-13 18:23       ` [PATCH RFC3 02/13] Docs: send-email: Refer to CONFIGURATION section for sendemail.multiedit Michael Witten
2009-04-13 18:23         ` [PATCH RFC3 03/13] Docs: send-email: Remove superfluous information in CONFIGURATION Michael Witten
2009-04-13 18:23           ` [PATCH RFC3 04/13] Docs: send-email: --smtp-server-port can take symbolic ports Michael Witten
2009-04-13 18:23             ` [PATCH RFC3 05/13] send-email: Cleanup the usage text and docs a bit Michael Witten
2009-04-13 18:23               ` [PATCH RFC3 06/13] send-email: Handle "GIT:" rather than "GIT: " during --compose Michael Witten
2009-04-13 18:23                 ` [PATCH RFC3 07/13] send-email: 'References:' should only reference what is sent Michael Witten
2009-04-13 18:23                   ` [PATCH RFC3 08/13] send-email: Remove superfluous `my $editor = ...' Michael Witten
2009-04-13 18:23                     ` [PATCH RFC3 09/13] send-email: Remove horrible mix of tabs and spaces Michael Witten
2009-04-13 18:23                       ` [PATCH RFC3 10/13] send-email: Add --sleep for email throttling Michael Witten
2009-04-13 18:23                         ` [PATCH RFC3 11/13] send-email: Minor cleanup of $smtp_server usage and send_message() Michael Witten
2009-04-13 18:23                           ` [PATCH RFC3 12/13] send-email: --compose takes optional argument to existing file Michael Witten
2009-04-13 18:23 52%                         ` [PATCH RFC3 13/13] send-email: --compose always includes a 'GIT: ' prefixed list of patch subjects Michael Witten
2007-03-11 17:19     [PATCH 0/2] git-send-email improvements Avi Kivity
2007-03-11 17:19 53% ` [PATCH 2/2] git-send-email: configurable bcc and chain-reply-to Avi Kivity
2010-03-07 18:38     [PATCH] Add tests for git format-patch --to and format.to config option Junio C Hamano
2010-03-07 21:33 55% ` [PATCH 1/4] send-email: actually add bcc headers Stephen Boyd
2021-02-15 14:07     git-send-email: smtpserver in $HOME Jan “Khardix” Staněk
2021-02-16  2:14 62% ` Junio C Hamano
2021-02-16 12:49 60%   ` Jan “Khardix” Staněk
2010-06-17  2:03     What's cooking in git.git (Jun 2010, #02; Wed, 16) Junio C Hamano
2010-06-17 20:10 57% ` [PATCH v2] send-email: ask about and declare 8bit mails Thomas Rast
2008-09-29 16:29     [RFC 7/9] send-email: Completely replace --signed-off-cc with --signed-off-by-cc Jeff King
2008-09-29 17:41     ` [RFC2 8/9] Docs: send-email: Create logical groupings for man text Michael Witten
2008-09-29 17:41 53%   ` [RFC2 9/9] send-email: signedoffcc -> signedoffbycc, but handle both Michael Witten
2018-11-02  1:53     [PATCH] send-email: Avoid empty transfer encoding header brian m. carlson
2018-11-02  9:52 52% ` [PATCH v2] " Aaron Lindsay
2015-05-31 22:29     [PATCH 0/9] send-email: add sendmail aliases line continuation support Eric Sunshine
2015-05-31 22:29 51% ` [PATCH 7/9] send-email: implement " Eric Sunshine
2011-07-29  1:34     [PATCH] git-send-email: Add auto-cc to all body signatures Joe Perches
2011-07-29  1:43     ` Jeff Kirsher
2011-12-08  2:58       ` Joe Perches
2011-12-08 19:37         ` Junio C Hamano
2011-12-08 20:51           ` Joe Perches
2015-12-02 10:04             ` Rasmus Villemoes
2015-12-02 17:00 61%           ` [PATCH V3] " Joe Perches
2009-06-06 12:14     [PATCH QGit 0/4] enhancements for the context menu of the Rev list Markus Heidelberg
2009-06-07 15:20     ` [PATCH 1/2] add a test case for threaded mails without chain-reply-to Markus Heidelberg
2009-06-07 15:20 53%   ` [PATCH 2/2] send-email: fix " Markus Heidelberg
2007-08-09 13:27     [PATCH 0/2] patches for send-email Uwe Kleine-König
2007-08-09 13:27 62% ` [PATCH 1/2] send-email: rfc822 forbids using <address@domain> without a non-empty "phrase" Uwe Kleine-König
2012-11-11 17:04     [PATCH 0/2] send-email: new series-cc-cmd option Felipe Contreras
2012-11-11 17:04 51% ` [PATCH 2/2] send-email: add " Felipe Contreras
2017-11-19 12:35     [PATCH] git-send-email: honor $PATH Florian Klink
2017-11-28  0:49 55% ` [PATCH v3] git-send-email: honor $PATH for sendmail binary Florian Klink
2014-11-25 14:00     [PATCH 0/2] git-send-email: add --transfer-encoding option for conversion to specified encoding Paolo Bonzini
2014-11-25 14:00 52% ` [PATCH 2/2] git-send-email: add --transfer-encoding option Paolo Bonzini
2010-09-24 12:56     Let's bump the minimum Perl version to 5.8 Ævar Arnfjörð Bjarmason
2010-09-24 20:00 61% ` [PATCH] perl: use "use warnings" instead of -w Ævar Arnfjörð Bjarmason
2010-09-24 20:00 56% ` [PATCH/RFC] perl: bump the required Perl version to 5.8 from 5.6.[21] Ævar Arnfjörð Bjarmason
2013-07-05 12:05     [PATCH v2 0/2] Squelch warning from send-email Ramkumar Ramachandra
2013-07-05 12:05     ` [PATCH v2 1/2] send-email: squelch warning from Net::SMTP::SSL Ramkumar Ramachandra
2013-07-06 14:28       ` Torsten Bögershausen
2013-07-06 14:32         ` brian m. carlson
2013-07-06 15:49           ` Torsten Bögershausen
2013-07-14 13:49             ` Ramkumar Ramachandra
2013-07-14 17:03               ` brian m. carlson
2013-07-15  3:07                 ` Torsten Bögershausen
2013-07-16  0:15                   ` [PATCH] send-email: improve SSL certificate verification brian m. carlson
2013-07-16  2:33                     ` Torsten Bögershausen
2013-07-18 16:53 55%                   ` Re* " Junio C Hamano
2010-06-02  0:11     [PATCH/RFC v3 0/7] Add internationalization support to Git Ævar Arnfjörð Bjarmason
2010-06-02  1:06 55% ` [PATCH/RFC v4 3/7] gettext: Add a Gettext interface for Perl Ævar Arnfjörð Bjarmason
2021-10-09  6:38     [PATCH v6 2/3] send-email: programmatically generate bash completions Carlo Marcelo Arenas Belón
2021-10-11  4:10 53% ` [PATCH v7 3/3] send-email docs: add format-patch options Thiago Perrotta

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).