Package: quilt / 0.63-8

dep3mail Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Description: allow mail command to grab the mail title from dep3 formalism
 If the patch is formatted according to http://dep.debian.net/deps/dep3/ 
 then the mail subcommand will manage to extract a mail subject and
 description out of this formalism.
Forwarded: Sent 2014-01-18

---
 quilt/mail.in |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

Index: b/quilt/mail.in
===================================================================
--- a/quilt/mail.in
+++ b/quilt/mail.in
@@ -342,6 +342,18 @@
 			' $tmpdir/patch > $tmpdir/body
 		fi
 
+		# Does this patch have a Description: block?
+		if [ -z "$subject" ]
+		then
+			subject=$(formail -x Description: < $tmpdir/header |head -n 1)
+			if [ -n "$subject" ]
+			then
+				# Get all dep3 pseudo-headers (but the first line of the description, already used as a subject)
+				# into the body of the generated mail, plus the patch.
+				sed -e 's/^Description:.*$/Description:/' $tmpdir/patch > $tmpdir/body
+			fi
+		fi
+
 		# Does this patch have DESC // subject // EDESC?
 		if [ -z "$subject" ]
 		then
@@ -446,10 +458,14 @@
 	subject=$(formail -x Replace-Subject: < "$tmpdir/$patch" | join_lines)
 	if [ $status -ne 0 -o -z "$subject" ]
 	then
-		printf \
+		subject=$(formail -x Description: < "$tmpdir/$patch" | head -n 1)
+		if [ $status -ne 0 -o -z "$subject" ]
+		then
+			printf \
 $"Unable to extract a subject header from %s\n" "$(print_patch "$patch")" >&2
-		rm -rf $tmpdir
-		exit 1
+			rm -rf $tmpdir
+			exit 1
+		fi
 	fi
 	subjects[${#subjects[@]}]="$patch"$'\t'"$subject"
 done