Skip to content

Commit

Permalink
Introduce advise() to print hints
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonathan Nieder authored and Junio C Hamano committed Aug 16, 2010
1 parent 130ab8a commit 2a41dfb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions builtin/revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2a41dfb

Please sign in to comment.