summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-02-14 20:54:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-14 20:54:19 (GMT)
commitdaef1b300b07c3d17d47c3bf01ebde28b62ff3fe (patch)
tree3907573bbdd40095398e9cd159d3e971d4233a18 /builtin
parentd8437c57fa0752716dde2d3747e7c22bf7ce2e41 (diff)
parent887a0fd57336dc5ff3ac28b6de0be91278e9e179 (diff)
downloadgit-daef1b300b07c3d17d47c3bf01ebde28b62ff3fe.zip
git-daef1b300b07c3d17d47c3bf01ebde28b62ff3fe.tar.gz
git-daef1b300b07c3d17d47c3bf01ebde28b62ff3fe.tar.bz2
Merge branch 'hw/advice-add-nothing'
Two help messages given when "git add" notices the user gave it nothing to add have been updated to use advise() API. * hw/advice-add-nothing: add: change advice config variables used by the add API add: use advise function to display hints
Diffstat (limited to 'builtin')
-rw-r--r--builtin/add.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/builtin/add.c b/builtin/add.c
index f7e627f..18a0881 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -406,7 +406,10 @@ 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_ignored_file)
+ advise(_("Use -f if you really want to add them.\n"
+ "Turn this message off by running\n"
+ "\"git config advice.addIgnoredFile false\""));
exit_status = 1;
}
@@ -507,7 +510,10 @@ 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_empty_pathspec)
+ advise( _("Maybe you wanted to say 'git add .'?\n"
+ "Turn this message off by running\n"
+ "\"git config advice.addEmptyPathspec false\""));
return 0;
}