So here is an attempt to libify "git mailinfo" so that the built-in version of "git am" does not have to run it via run_command() interface. "git am", when fed an N-patch series, runs one "mailsplit", N "mailinfo" and N "apply" all via run_command() interface (plus 2 more "apply" and 1 "merge-recursive" per a patch that does not apply cleanly, when run with the "-3" option), and among the various programs spawned from "git am", "mailinfo" is the most straight-forward, stupid and light-weight program, so it is a no-brainer to pick it as the candidate for libification. This goes on top of c5920b21 (mailinfo: ignore in-body header that we do not care about, 2015-10-08) that was posted earlier as a weatherbaloon patch. Junio C Hamano (26): mailinfo: remove a no-op call convert_to_utf8(it, "") mailinfo: fix for off-by-one error in boundary stack mailinfo: fold decode_header_bq() into decode_header() mailinfo: move handle_boundary() lower mailinfo: get rid of function-local static states mailinfo: always pass "line" as an argument mailinfo: move global "line" into mailinfo() function mailinfo: introduce "struct mailinfo" to hold globals mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo mailinfo: move global "FILE *fin, *fout" to struct mailinfo mailinfo: move filter/header stage to struct mailinfo mailinfo: move patch_lines to struct mailinfo mailinfo: move add_message_id and message_id to struct mailinfo mailinfo: move use_scissors and use_inbody_headers to struct mailinfo mailinfo: move metainfo_charset to struct mailinfo mailinfo: move transfer_encoding to struct mailinfo mailinfo: move charset to struct mailinfo mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak mailinfo: move cmitmsg and patchfile to struct mailinfo mailinfo: move [ps]_hdr_data to struct mailinfo mailinfo: keep the parsed log message in a strbuf mailinfo: move content/content_top to struct mailinfo mailinfo: handle errors found in decode_header() better mailinfo: handle charset conversion errors in the caller mailinfo: remove calls to exit() and die() deep in the callchain mailinfo: libify the whole thing Makefile | 1 + builtin/mailinfo.c | 1083 +--------------------------------------------------- mailinfo.c | 1058 ++++++++++++++++++++++++++++++++++++++++++++++++++ mailinfo.h | 41 ++ 4 files changed, 1120 insertions(+), 1063 deletions(-) create mode 100644 mailinfo.c create mode 100644 mailinfo.h -- 2.6.1-320-g86a1181 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html