[PATCH v2 00/31] libify mailinfo and call it directly from am
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 14, 2015, 20:45 UTC
- Message-ID
- <1444855557-2127-1-git-send-email-gitster@pobox.com>
- In-Reply-To
- <1444778207-859-1-git-send-email-gitster@pobox.com>
During the discussion on the recent "git am" regression, I noticed that the command reimplemented in C spawns one "mailsplit" and then spawns "mailinfo" followed by "apply --index" to commit the changes described in each message. As there are platforms where spawning subprocess via run_command() interface is heavy-weight, something that is conceptually very simple like "mailinfo" is better called directly inside the process---something that is lightweight and frequently used is where the overhead of run_command() would be felt most.
And here is that topic, slightly reordered and polished up, since yesterday's version.
- The series no longer depends on an unrelated "how about this" patch to mailinfo.
- Fixes are moved to earlier spots in the series.
- Error checking in the endgame patch has been tightened.
Junio C Hamano (31): mailinfo: remove a no-op call convert_to_utf8(it, "") mailinfo: fix for off-by-one error in boundary stack mailinfo: explicitly close file handle to the patch output 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: move read_one_header_line() closer to its callers mailinfo: move check_header() after the helpers it uses mailinfo: move cleanup_space() before its users mailinfo: move definition of MAX_HDR_PARSED to closer to its use mailinfo: libify mailinfo: handle charset conversion errors in the caller mailinfo: remove calls to exit() and die() deep in the callchain am: make direct call to mailinfo
Makefile | 1 + builtin/am.c | 42 ++- builtin/mailinfo.c | 1055 +--------------------------------------------------- mailinfo.c | 1024 ++++++++++++++++++++++++++++++++++++++++++++++++++ mailinfo.h | 41 ++ 5 files changed, 1109 insertions(+), 1054 deletions(-) create mode 100644 mailinfo.c create mode 100644 mailinfo.h
-- 2.6.1-320-g86a1181