summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-08-11 08:36:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-16 02:12:05 (GMT)
commit2a41dfb03b93c3e5b7d1deca537276aed063a044 (patch)
tree6e48b2743fa78304217d3accb28ca875f6d2ebfe /builtin
parent130ab8ab9c64b59b367c08a041200b6b75758b91 (diff)
downloadgit-2a41dfb03b93c3e5b7d1deca537276aed063a044.zip
git-2a41dfb03b93c3e5b7d1deca537276aed063a044.tar.gz
git-2a41dfb03b93c3e5b7d1deca537276aed063a044.tar.bz2
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/revert.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin/revert.c b/builtin/revert.c
index c3d64af..74c1581 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -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;