@matheusbsbs / matheus-bagliano / commits / 81c5cf7865
Fork 0

mailinfo: skip bogus UNIX From line inside body

Sometimes people just include the whole format-patch output in the commit e-mail. Detect it and skip the bogus ">From " line. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed May 21, 2006 at 17:15 UTC 81c5cf786581c82a8834726ffef26b7def96bf35
1 file changed +7
mailinfo.c
+7
@@ -237,10 +237,17 @@ static int eatspace(char *line)
237 #define SEEN_FROM 01
238 #define SEEN_DATE 02
239 #define SEEN_SUBJECT 04
240 +#define SEEN_BOGUS_UNIX_FROM 010
241
242 /* First lines of body can have From:, Date:, and Subject: */
243 static int handle_inbody_header(int *seen, char *line)
244 {
245 + if (!memcmp(">From", line, 5) && isspace(line[5])) {
246 + if (!(*seen & SEEN_BOGUS_UNIX_FROM)) {
247 + *seen |= SEEN_BOGUS_UNIX_FROM;
248 + return 1;
249 + }
250 + }
251 if (!memcmp("From:", line, 5) && isspace(line[5])) {
252 if (!(*seen & SEEN_FROM) && handle_from(line+6)) {
253 *seen |= SEEN_FROM;