path: root/builtin/add.c
diff options
authorHeba Waly <>2020-01-07 23:12:32 (GMT)
committerJunio C Hamano <>2020-01-15 20:15:04 (GMT)
commitbf66db37f1e17b71e8edb93d78ec407fbc1e0989 (patch)
treef7deea5a692390a58ab180197cac01e29d5b81fa /builtin/add.c
parentd0654dc308b0ba76dd8ed7bbb33c8d8f7aacd783 (diff)
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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/add.c')
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/add.c b/builtin/add.c
index 4c38aff..57b3186 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 && == 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;