Skip to content

Commit 2a41dfb

Browse files
jrngitster
authored andcommitted
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>
1 parent 130ab8a commit 2a41dfb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

builtin/revert.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,15 @@ static void set_author_ident_env(const char *message)
241241
sha1_to_hex(commit->object.sha1));
242242
}
243243

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+
244253
static char *help_msg(void)
245254
{
246255
struct strbuf helpbuf = STRBUF_INIT;

0 commit comments

Comments
 (0)