{"thread":{"id":"7612","subject":"[PATCH 1/2] diff: allow showing a warning message before the diff.","startedAt":"2007-04-11T20:58:13Z","lastAt":"2007-04-11T20:58:13Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"39133","messageId":"7vbqhuocgq.fsf@assigned-by-dhcp.cox.net","threadId":"7612","inReplyTo":null,"subject":"[PATCH 1/2] diff: allow showing a warning message before the diff.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-11T20:58:13Z","receivedAt":"2007-04-11T20:58:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This allows the caller to add an informational message at the\nbeginning of the diff, when output is produced by diff_flush().\nIt (ab)uses the WHITESPACE color; we should probably have named\nthat as WARNING color instead, as the existing use is already\nabout warnings.\n\nNobody uses this yet, but the next one does.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n diff.c |    7 +++++++\n diff.h |    1 +\n 2 files changed, 8 insertions(+), 0 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex d8f9242..3cdb47a 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2796,6 +2796,13 @@ void diff_flush(struct diff_options *options)\n \tif (!q->nr)\n \t\tgoto free_queue;\n \n+\tif (options->warning) {\n+\t\tconst char *reset, *set;\n+\t\tset = diff_get_color(options->color_diff, DIFF_WHITESPACE);\n+\t\treset = diff_get_color(options->color_diff, DIFF_RESET);\n+\t\tprintf(\"%s%s%s\\n\", set, options->warning, reset);\n+\t}\n+\n \tif (output_format & (DIFF_FORMAT_RAW |\n \t\t\t     DIFF_FORMAT_NAME |\n \t\t\t     DIFF_FORMAT_NAME_STATUS |\ndiff --git a/diff.h b/diff.h\nindex a0d2ce1..2fc86eb 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -48,6 +48,7 @@ struct diff_options {\n \tconst char *orderfile;\n \tconst char *pickaxe;\n \tconst char *single_follow;\n+\tconst char *warning;\n \tunsigned recursive:1,\n \t\t tree_in_recursive:1,\n \t\t binary:1,\n-- \n1.5.1.777.gd14d3\n"}]}