diff options
author | Heba Waly <heba.waly@gmail.com> | 2020-01-07 23:12:32 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-01-15 12:15:04 -0800 |
commit | bf66db37f1e17b71e8edb93d78ec407fbc1e0989 (patch) | |
tree | f7deea5a692390a58ab180197cac01e29d5b81fa /builtin/add.c | |
parent | Git 2.25 (diff) | |
download | tgif-bf66db37f1e17b71e8edb93d78ec407fbc1e0989.tar.xz |
add: use advise function to display hints
Use the advise function in advice.c to display hints to the users, as
it provides a neat and a standard format for hint messages, i.e: the
text is colored in yellow and the line starts by the word "hint:".
Also this will enable us to control the messages using advice.*
configuration variables.
Signed-off-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/add.c')
-rw-r--r-- | builtin/add.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/add.c b/builtin/add.c index 4c38aff419..57b3186f69 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -390,7 +390,8 @@ static int add_files(struct dir_struct *dir, int flags) fprintf(stderr, _(ignore_error)); for (i = 0; i < dir->ignored_nr; i++) fprintf(stderr, "%s\n", dir->ignored[i]->name); - fprintf(stderr, _("Use -f if you really want to add them.\n")); + if (advice_add_nothing) + advise(_("Use -f if you really want to add them.\n")); exit_status = 1; } @@ -480,7 +481,8 @@ int cmd_add(int argc, const char **argv, const char *prefix) if (require_pathspec && pathspec.nr == 0) { fprintf(stderr, _("Nothing specified, nothing added.\n")); - fprintf(stderr, _("Maybe you wanted to say 'git add .'?\n")); + if (advice_add_nothing) + advise( _("Maybe you wanted to say 'git add .'?\n")); return 0; } |