These two are the only easy ones that do not require passing the structure around to deep corners of the callchain. Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- builtin/mailinfo.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index e3c0c31..08c67f5 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -9,13 +9,13 @@ static FILE *cmitmsg, *patchfile, *fin, *fout; -static int keep_subject; -static int keep_non_patch_brackets_in_subject; static const char *metainfo_charset; struct mailinfo { struct strbuf name; struct strbuf email; + int keep_subject; + int keep_non_patch_brackets_in_subject; }; static char *message_id; @@ -224,7 +224,7 @@ static int is_multipart_boundary(const struct strbuf *line) !memcmp(line->buf, (*content_top)->buf, (*content_top)->len)); } -static void cleanup_subject(struct strbuf *subject) +static void cleanup_subject(struct mailinfo *mi, struct strbuf *subject) { size_t at = 0; @@ -252,7 +252,7 @@ static void cleanup_subject(struct strbuf *subject) if (!pos) break; remove = pos - subject->buf + at + 1; - if (!keep_non_patch_brackets_in_subject || + if (!mi->keep_non_patch_brackets_in_subject || (7 <= remove && memmem(subject->buf + at, remove, "PATCH", 5))) strbuf_remove(subject, at, remove); @@ -947,8 +947,8 @@ static void handle_info(struct mailinfo *mi) continue; if (!strcmp(header[i], "Subject")) { - if (!keep_subject) { - cleanup_subject(hdr); + if (!mi->keep_subject) { + cleanup_subject(mi, hdr); cleanup_space(hdr); } output_header_lines(fout, "Subject", hdr); @@ -1051,9 +1051,9 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix) while (1 < argc && argv[1][0] == '-') { if (!strcmp(argv[1], "-k")) - keep_subject = 1; + mi.keep_subject = 1; else if (!strcmp(argv[1], "-b")) - keep_non_patch_brackets_in_subject = 1; + mi.keep_non_patch_brackets_in_subject = 1; else if (!strcmp(argv[1], "-m") || !strcmp(argv[1], "--message-id")) add_message_id = 1; else if (!strcmp(argv[1], "-u")) -- 2.6.2-383-g144b2e6 -- 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