Introduce advise() to print hints
authorJonathan Nieder <jrnieder@gmail.com>
Wed, 11 Aug 2010 08:36:41 +0000 (03:36 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Aug 2010 02:12:05 +0000 (19:12 -0700)
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>
builtin/revert.c
index c3d64af02ded50a7dcd971d879210cb82d1d26b0..74c1581fdc73129e61c2ade90701900586e3ee82 100644 (file)
@@ -241,6 +241,15 @@ static void set_author_ident_env(const char *message)
                        sha1_to_hex(commit->object.sha1));
 }
 
+static void advise(const char *advice, ...)
+{
+       va_list params;
+
+       va_start(params, advice);
+       vreportf("hint: ", advice, params);
+       va_end(params);
+}
+
 static char *help_msg(void)
 {
        struct strbuf helpbuf = STRBUF_INIT;