{"thread":{"id":"43162","subject":"[PATCH] mailinfo: hack to accept in-line annotations in patches.","startedAt":"2006-12-12T01:15:48Z","lastAt":"2006-12-12T01:15:48Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"293951","messageId":"7vu001zzgb.fsf@assigned-by-dhcp.cox.net","threadId":"43162","inReplyTo":null,"subject":"[PATCH] mailinfo: hack to accept in-line annotations in patches.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-12-12T01:15:48Z","receivedAt":"2006-12-12T01:15:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Long before git-apply, when I wanted to talk about rationale of\nindividual changes, I used to add annotation between hunks\n(delimited @@ -n,m, +l,k @@) as unindented plain text and rely\non GNU patch to discard them as garbage.  Because git-apply is\nmuch less forgiving than GNU patch, this is not possible.\n\nThis patch teaches mailinfo that lines that begin with a '|' would\nnever appear in the patch text and can be discarded safely.\nWhich means that we can generate a patch as usual using format-patch,\nand add annotations inline, prefixed with '|'.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n * I am not seriously suggesting this for inclusion but people\n   might find this handy -- see the first edition of my\n   git-commit documentation patch for an example (although I\n   seem to have botched the hand-munge of that message).\n\n builtin-mailinfo.c |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\nindex b8d7dbc..7819be1 100644\n--- a/builtin-mailinfo.c\n+++ b/builtin-mailinfo.c\n@@ -710,8 +710,11 @@ static void handle_patch(void)\n \t\t * here; we are dealing with the user payload.\n \t\t */\n \t\tdecode_transfer_encoding(line);\n-\t\tfputs(line, patchfile);\n-\t\tpatch_lines++;\n+\n+\t\tif (line[0] != '|') {\n+\t\t\tfputs(line, patchfile);\n+\t\t\tpatch_lines++;\n+\t\t}\n \t} while (fgets(line, sizeof(line), fin) != NULL);\n }\n \n-- \n1.4.4.2.g7d2d-dirty\n\n"}]}