1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 00:37:55 +01:00
git/mailinfo.h
Jonathan Tan 6b4b013f18 mailinfo: handle in-body header continuations
Mailinfo currently handles multi-line headers, but it does not handle
multi-line in-body headers. Teach it to handle such headers, for
example, for this input:

  From: author <author@example.com>
  Date: Fri, 9 Jun 2006 00:44:16 -0700
  Subject: a very long
   broken line

  Subject: another very long
   broken line

interpret the in-body subject to be "another very long broken line"
instead of "another very long".

An existing test (t/t5100/msg0015) has an indented line immediately
after an in-body header - it has been modified to reflect the new
functionality.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-21 10:23:11 -07:00

42 lines
991 B
C

#ifndef MAILINFO_H
#define MAILINFO_H
#define MAX_BOUNDARIES 5
struct mailinfo {
FILE *input;
FILE *output;
FILE *patchfile;
struct strbuf name;
struct strbuf email;
int keep_subject;
int keep_non_patch_brackets_in_subject;
int add_message_id;
int use_scissors;
int use_inbody_headers;
const char *metainfo_charset;
struct strbuf *content[MAX_BOUNDARIES];
struct strbuf **content_top;
struct strbuf charset;
char *message_id;
enum {
TE_DONTCARE, TE_QP, TE_BASE64
} transfer_encoding;
int patch_lines;
int filter_stage; /* still reading log or are we copying patch? */
int header_stage; /* still checking in-body headers? */
struct strbuf inbody_header_accum;
struct strbuf **p_hdr_data;
struct strbuf **s_hdr_data;
struct strbuf log_message;
int input_error;
};
extern void setup_mailinfo(struct mailinfo *);
extern int mailinfo(struct mailinfo *, const char *msg, const char *patch);
extern void clear_mailinfo(struct mailinfo *);
#endif /* MAILINFO_H */