[PATCH RFC3.5.1 08/12] send-email: Simplify --compose subject sanitation
- From
Michael Witten <mfwitten@gmail.com>
- Date
- Apr 19, 2009, 16:43 UTC
- Message-ID
- <1240159421-5643-1-git-send-email-mfwitten@gmail.com>
- In-Reply-To
- <b4087cc50904190753v6f5862c0sebe2dcc56c5269dc@mail.gmail.com>
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 <mfwitten@gmail.com> --- 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