Thread (39 messages) flat view 39 messages, 6 authors, 2016-06-15
STALE3735d

[PATCH RFC3.5.1 08/12] send-email: Simplify --compose subject sanitation

From: Michael Witten <hidden>
Date: 2016-06-15 22:46:37
Subsystem: the rest · Maintainer: Linus Torvalds

We might as well use the global variables while they exist; there's
no reason to print the result to a file and then read it back in.

Also, the entire file is already read and checked for:

	/[^[:ascii:]]/

by:

	my $need_8bit_cte = file_has_nonascii($compose_filename);

so we might as well use $need_8bit_cte until something less egregiously
inefficient is implemented.

Signed-off-by: Michael Witten <redacted>
---
 git-send-email.perl |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 3894a93..1f815d7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -675,13 +675,8 @@ EOT
 		} elsif (/^MIME-Version:/i) {
 			$need_8bit_cte = 0;
 		} elsif (/^Subject:\s*(.+)\s*$/i) {
-			$initial_subject = $1;
-			my $subject = $initial_subject;
-			$_ = "Subject: " .
-				($subject =~ /[^[:ascii:]]/ ?
-				 quote_rfc2047($subject) :
-				 $subject) .
-				"\n";
+			$initial_subject = $need_8bit_cte ? quote_rfc2047($1) : $1;
+			next;
 		} elsif (/^In-Reply-To:\s*(.+)\s*$/i) {
 			$initial_reply_to = $1;
 			next;
-- 
1.6.2.2.479.g2aec
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help