quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH] quilt mail: Handle line breaks in subject


From: Steven Rostedt
Subject: [Quilt-dev] [PATCH] quilt mail: Handle line breaks in subject
Date: Mon, 10 Oct 2011 15:00:51 -0400

I just finished the below patch and noticed that you already did it :-p

http://git.savannah.gnu.org/cgit/quilt.git/commit/?id=d2b4b7a2fd61df4ab33cbbaf8efdcfc44f1028bb


Side note, I have my own patch that I add every time I update quilt to
add a bunch of *-by: tags to email. Because I sometimes have
"Suggested-by" or "Reported-by", etc. And I feel they should also be
Cc'd on the patch. Basically I add this:

diff --git a/quilt/mail.in b/quilt/mail.in
index ba35114..490112f 100644
--- a/quilt/mail.in
+++ b/quilt/mail.in
@@ -399,7 +399,7 @@ then
                sed -n -e "/\<${LOGNAME:-$(whoami)}@/d" \
                       -e 's/^\(To\|Cc\):/Recipient-\1:/ip' \
                       -e 's/^\(\(Signed-off-by\|Acked-by\):[ 
'$'\t'']*\)\([^"]*\(,[^"]*\)\+[^" '$'\t'']\)\([ '$'\t'']*<.*>\)/\1"\3"\5/i' \
-                      -e 's/^\(Signed-off-by\|Acked-by\):/Recipient-Cc:/ip' \
+                      -e 
's/^\(Signed-off-by\|Acked-by\|Suggested-by\|Reviewed-by\|Requested-by\|Reported-by\|Tested-by\):/Recipient-Cc:/ip'
 \
                    $tmpdir/header
 
                echo

What's your thoughts on adding all these tags. Or maybe even add
something in .quiltrc to allow users to choose what they want?

Thoughts?

-- Steve




Greg Kroah-Hartman complained that quilt will truncate subjects that are
broken among multiple lines (as git pretty=email will do).

Quilt should handle this without a problem. It was not easy to fix this
as the subject header name is changed to parse it later and then fed
through another script to replace it.

The fix was to change the two awk scripts to recognize multiple lined
subjects.

Signed-off-by: Steven Rostedt <address@hidden>

diff --git a/mail b/mail
index 3437ecc..627b5bd 100755
--- a/mail
+++ b/mail
@@ -586,6 +586,14 @@ for patch in "address@hidden"; do
        new_date="$(date --rfc-822 -d "1970/01/01 UTC $last_ts seconds")"
 
        modify="$(awk '
+       function print_subject(line) {
+                                 r = line
+                                 sub(/:.*/, "", r)
+                                 s = line
+                                 sub(/^[^:]*:[ \t]*/, "", s)
+                                 gsub(/'\''/, "'\'\''", s)
+                                 print "--replace-header " r "='\''" s "'\'' 
\\"
+                               }
        sub(/^Recipient-/, "")  { r = $0
                                  sub(/:.*/, "", r)
                                  s = $0
@@ -593,13 +601,22 @@ for patch in "address@hidden"; do
                                  gsub(/'\''/, "'\'\''", s)
                                  print "--add-recipient " r "='\''" s "'\'' \\"
                                }
-       sub(/^Replace-/, "")    { r = $0
-                                 sub(/:.*/, "", r)
-                                 s = $0
-                                 sub(/^[^:]*:[ \t]*/, "", s)
-                                 gsub(/'\''/, "'\'\''", s)
-                                 print "--replace-header " r "='\''" s "'\'' 
\\"
+       insubject               { if (/^[ \t][ \t]*[^ \t]/) {
+                                       subject = subject $0
+                                 } else {
+                                       print_subject(subject)
+                                       insubject = 0;
+                                 }
+                               }
+       sub(/^Replace-/, "")    { subject = $0
+                                 insubject = 1
+                               }
+       END                     {
+                                 if (insubject) {
+                                       print_subject(subject)
+                                 }
                                }
+                                       
        ' $body)"
 #      echo "$modify" | sed -e 's/^/>> /' >&2
        p=${subject_prefix//@num@/$(printf %0*d ${#total} $num)}
@@ -614,7 +631,9 @@ for patch in "address@hidden"; do
                echo "Content-Disposition: inline; filename=$patch"
                awk '
                    !in_body && tolower($0) ~ /^(recipient|replace)-.*:/ \
-                               { next }
+                               { skip = 1; next }
+                   skip && /^[ \t]/ { next }
+                   skip        { skip = 0; }
                    /^$/        { in_body = 1 }
                                { print }
                    ' $body





reply via email to

[Prev in Thread] Current Thread [Next in Thread]