diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-02-14 12:54:19 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-14 12:54:19 -0800 |
commit | daef1b300b07c3d17d47c3bf01ebde28b62ff3fe (patch) | |
tree | 3907573bbdd40095398e9cd159d3e971d4233a18 /builtin | |
parent | The fourth batch for 2.26 (diff) | |
parent | add: change advice config variables used by the add API (diff) | |
download | tgif-daef1b300b07c3d17d47c3bf01ebde28b62ff3fe.tar.xz |
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.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/builtin/add.c b/builtin/add.c index f7e627f3b9..18a0881ecf 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; } |