{"thread":{"id":"52752","subject":"[Outreachy][PATCH 0/1] add: change advice config variables used by the add API","startedAt":"2020-02-06T10:57:56Z","lastAt":"2020-02-06T10:58:05Z","messageCount":2,"participants":["Heba Waly"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"391242","messageId":"20200206105730.16231-1-heba.waly@gmail.com","threadId":"52752","inReplyTo":null,"subject":"[Outreachy][PATCH 0/1] add: change advice config variables used by the add API","fromName":"Heba Waly","fromEmail":"heba.waly@gmail.com","sentAt":"2020-02-06T10:57:29Z","receivedAt":"2020-02-06T10:57:56Z","isPatch":true,"sender":{"key":"heba.waly@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1539076?v=4"},"body":"advice.addNothing config variable is used to control the visibility of\ntwo advice messages in the add library. This config variable is\nreplaced by two new variables, whose names are more clear and relevant\nto the two cases.\n\nAlso add the two new variables to the documentation.\n\nHeba Waly (1):\n  add: change advice config variables used by the add API\n\n Documentation/config/advice.txt |  6 ++++++\n advice.c                        |  6 ++++--\n advice.h                        |  3 ++-\n builtin/add.c                   | 12 ++++++++----\n t/t3700-add.sh                  |  2 ++\n 5 files changed, 22 insertions(+), 7 deletions(-)\n\n--\nThis change is built on top of hw/advice-add-nothing\n\n2.21.0 (Apple Git-122.2)\n\n"},{"id":"391243","messageId":"20200206105730.16231-2-heba.waly@gmail.com","threadId":"52752","inReplyTo":"20200206105730.16231-1-heba.waly@gmail.com","subject":"[PATCH 1/1] add: change advice config variables used by the add API","fromName":"Heba Waly","fromEmail":"heba.waly@gmail.com","sentAt":"2020-02-06T10:57:30Z","receivedAt":"2020-02-06T10:58:05Z","isPatch":true,"sender":{"key":"heba.waly@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1539076?v=4"},"body":"advice.addNothing config variable is used to control the visibility of\ntwo advice messages in the add library. This config variable is\nreplaced by two new variables, whose names are more clear and relevant\nto the two cases.\n\nAlso add the two new variables to the documentation.\n\nSigned-off-by: Heba Waly <heba.waly@gmail.com>\n---\n Documentation/config/advice.txt |  6 ++++++\n advice.c                        |  6 ++++--\n advice.h                        |  3 ++-\n builtin/add.c                   | 12 ++++++++----\n t/t3700-add.sh                  |  2 ++\n 5 files changed, 22 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt\nindex 4be93f8ad9..bdd37c3eaa 100644\n--- a/Documentation/config/advice.txt\n+++ b/Documentation/config/advice.txt\n@@ -110,4 +110,10 @@ advice.*::\n \tsubmoduleAlternateErrorStrategyDie::\n \t\tAdvice shown when a submodule.alternateErrorStrategy option\n \t\tconfigured to \"die\" causes a fatal error.\n+\taddIgnoredFile::\n+\t\tAdvice shown if a user attempts to add an ignored file to\n+\t\tthe index.\n+\taddEmptyPathspec::\n+\t\tAdvice shown if a user runs the add command without providing\n+\t\tthe pathspec parameter.\n --\ndiff --git a/advice.c b/advice.c\nindex 098ac0abea..97f3f981b4 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -31,7 +31,8 @@ int advice_graft_file_deprecated = 1;\n int advice_checkout_ambiguous_remote_branch_name = 1;\n int advice_nested_tag = 1;\n int advice_submodule_alternate_error_strategy_die = 1;\n-int advice_add_nothing = 1;\n+int advice_add_ignored_file = 1;\n+int advice_add_empty_pathspec = 1;\n \n static int advice_use_color = -1;\n static char advice_colors[][COLOR_MAXLEN] = {\n@@ -92,7 +93,8 @@ static struct {\n \t{ \"checkoutAmbiguousRemoteBranchName\", &advice_checkout_ambiguous_remote_branch_name },\n \t{ \"nestedTag\", &advice_nested_tag },\n \t{ \"submoduleAlternateErrorStrategyDie\", &advice_submodule_alternate_error_strategy_die },\n-\t{ \"addNothing\", &advice_add_nothing },\n+\t{ \"addIgnoredFile\", &advice_add_ignored_file },\n+\t{ \"addEmptyPathspec\", &advice_add_empty_pathspec },\n \n \t/* make this an alias for backward compatibility */\n \t{ \"pushNonFastForward\", &advice_push_update_rejected }\ndiff --git a/advice.h b/advice.h\nindex 83287b0594..0e6e58d9f8 100644\n--- a/advice.h\n+++ b/advice.h\n@@ -31,7 +31,8 @@ extern int advice_graft_file_deprecated;\n extern int advice_checkout_ambiguous_remote_branch_name;\n extern int advice_nested_tag;\n extern int advice_submodule_alternate_error_strategy_die;\n-extern int advice_add_nothing;\n+extern int advice_add_ignored_file;\n+extern int advice_add_empty_pathspec;\n \n int git_default_advice_config(const char *var, const char *value);\n __attribute__((format (printf, 1, 2)))\ndiff --git a/builtin/add.c b/builtin/add.c\nindex 57b3186f69..0e66934f3a 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -390,8 +390,10 @@ static int add_files(struct dir_struct *dir, int flags)\n \t\tfprintf(stderr, _(ignore_error));\n \t\tfor (i = 0; i < dir->ignored_nr; i++)\n \t\t\tfprintf(stderr, \"%s\\n\", dir->ignored[i]->name);\n-\t\tif (advice_add_nothing)\n-\t\t\tadvise(_(\"Use -f if you really want to add them.\\n\"));\n+\t\tif (advice_add_ignored_file)\n+\t\t\tadvise(_(\"Use -f if you really want to add them.\\n\"\n+\t\t\t\t\"Turn this message off by running\\n\"\n+\t\t\t\t\"\\\"git config advice.addIgnoredFile false\\\"\"));\n \t\texit_status = 1;\n \t}\n \n@@ -481,8 +483,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)\n \n \tif (require_pathspec && pathspec.nr == 0) {\n \t\tfprintf(stderr, _(\"Nothing specified, nothing added.\\n\"));\n-\t\tif (advice_add_nothing)\n-\t\t\tadvise( _(\"Maybe you wanted to say 'git add .'?\\n\"));\n+\t\tif (advice_add_empty_pathspec)\n+\t\t\tadvise( _(\"Maybe you wanted to say 'git add .'?\\n\"\n+\t\t\t\t\"Turn this message off by running\\n\"\n+\t\t\t\t\"\\\"git config advice.addEmptyPathspec false\\\"\"));\n \t\treturn 0;\n \t}\n \ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex a649805369..88bc799807 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -327,6 +327,8 @@ cat >expect.err <<\\EOF\n The following paths are ignored by one of your .gitignore files:\n ignored-file\n hint: Use -f if you really want to add them.\n+hint: Turn this message off by running\n+hint: \"git config advice.addIgnoredFile false\"\n EOF\n cat >expect.out <<\\EOF\n add 'track-this'\n-- \n2.21.0 (Apple Git-122.2)\n\n"}]}