Introduce advise() to print hints
Like error(), warn(), and die(), advise() prints a short message with a formulaic prefix to stderr. It is local to revert.c for now because I am not sure this is the right API (we may want to take an array of advice lines or a boolean argument for easy suppression of unwanted advice). Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
Aug 11, 2010 at 03:36 UTC
2a41dfb03b93c3e5b7d1deca537276aed063a044
1 file changed
+9
builtin/revert.c
+9
@@ -241,6 +241,15 @@ static void set_author_ident_env(const char *message)
241
sha1_to_hex(commit->object.sha1));
242
}
243
244
+static void advise(const char *advice, ...)
245
+{
246
+ va_list params;
247
+
248
+ va_start(params, advice);
249
+ vreportf("hint: ", advice, params);
250
+ va_end(params);
251
+}
252
+
253
static char *help_msg(void)
254
{
255
struct strbuf helpbuf = STRBUF_INIT;