diff: allow showing a warning message before the diff.
PATCH 1/2 diff: allow showing a warning message before the diff.
This allows the caller to add an informational message at the beginning of the diff, when output is produced by diff_flush(). It (ab)uses the WHITESPACE color; we should probably have named that as WARNING color instead, as the existing use is already about warnings.
Nobody uses this yet, but the next one does.
Signed-off-by Junio C Hamano <[email protected]>
--- diff.c | 7 +++++++ diff.h | 1 + 2 files changed, 8 insertions(+), 0 deletions(-)
diff.c +7 -0
@@ -2796,6 +2796,13 @@ void diff_flush(struct diff_options *options)if (!q->nr) goto free_queue; +if (options->warning) { +const char *reset, *set; + set =diff_get_color (options->color_diff,DIFF_WHITESPACE ); + reset =diff_get_color (options->color_diff,DIFF_RESET ); +printf ("%s%s%s\n" , set, options->warning, reset); + } + if (output_format & (DIFF_FORMAT_RAW | DIFF_FORMAT_NAME | DIFF_FORMAT_NAME_STATUS |
diff.h +1 -0
@@ -48,6 +48,7 @@ struct diff_options {const char *orderfile;const char *pickaxe;const char *single_follow; +const char *warning; unsigned recursive:1, tree_in_recursive:1, binary:1,
Signature · 1 line
1.5.1.777.gd14d3