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>
This commit is contained in:
committed by
Junio C Hamano
parent
d0654dc308
commit
bf66db37f1
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user