Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeba Waly <heba.waly@gmail.com>2020-01-08 02:12:32 +0300
committerJunio C Hamano <gitster@pobox.com>2020-01-15 23:15:04 +0300
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 <heba.waly@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/add.c b/builtin/add.c
index 4c38aff4195..57b3186f69d 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;
}