From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Ben Boeckel" <mathstuf@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [RFC PATCH v3 3/4] advice: remove use of global advice_add_embedded_repo
Date: Fri, 6 Aug 2021 21:13:17 +0200 [thread overview]
Message-ID: <RFC-patch-v3-3.4-02613d0f30-20210806T191231Z-avarab@gmail.com> (raw)
In-Reply-To: <RFC-cover-v3-0.4-0000000000-20210806T191231Z-avarab@gmail.com>
The external use of this variable was added in 532139940c9 (add: warn
when adding an embedded repository, 2017-06-14), for the use-case it's
more straightforward to track whether we've adviced in
check_embedded_repo() than setting the global variable.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
advice.c | 2 --
advice.h | 1 -
builtin/add.c | 7 ++++---
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/advice.c b/advice.c
index b18833bc80..41cfea82d0 100644
--- a/advice.c
+++ b/advice.c
@@ -4,7 +4,6 @@
#include "help.h"
#include "string-list.h"
-int advice_add_embedded_repo = 1;
int advice_graft_file_deprecated = 1;
static int advice_use_color = -1;
@@ -38,7 +37,6 @@ static struct {
const char *name;
int *preference;
} advice_config[] = {
- { "addEmbeddedRepo", &advice_add_embedded_repo },
{ "graftFileDeprecated", &advice_graft_file_deprecated },
};
diff --git a/advice.h b/advice.h
index ed51db0f05..4b754f4c62 100644
--- a/advice.h
+++ b/advice.h
@@ -5,7 +5,6 @@
struct string_list;
-extern int advice_add_embedded_repo;
extern int advice_graft_file_deprecated;
/*
diff --git a/builtin/add.c b/builtin/add.c
index cf29b302d4..8a5dd29f3f 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -419,6 +419,7 @@ static const char embedded_advice[] = N_(
static void check_embedded_repo(const char *path)
{
struct strbuf name = STRBUF_INIT;
+ static int adviced_on_embedded_repo = 0;
if (!warn_on_embedded_repo)
return;
@@ -430,10 +431,10 @@ static void check_embedded_repo(const char *path)
strbuf_strip_suffix(&name, "/");
warning(_("adding embedded git repository: %s"), name.buf);
- if (advice_add_embedded_repo) {
+ if (!adviced_on_embedded_repo &&
+ advice_enabled(ADVICE_ADD_EMBEDDED_REPO)) {
advise(embedded_advice, name.buf, name.buf);
- /* there may be multiple entries; advise only once */
- advice_add_embedded_repo = 0;
+ adviced_on_embedded_repo = 1;
}
strbuf_release(&name);
--
2.33.0.rc0.680.gf07173a897a
next prev parent reply other threads:[~2021-08-06 19:13 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-31 2:25 [PATCH v1 0/4] advice: remove usage of `advice_*` global variables Ben Boeckel
2021-07-31 2:25 ` [PATCH v1 1/4] advice: add a function to set the value of an advice type Ben Boeckel
2021-08-02 21:56 ` Johannes Schindelin
2021-07-31 2:25 ` [PATCH v1 2/4] advice: add enum variants for missing advice variables Ben Boeckel
2021-08-02 21:52 ` Johannes Schindelin
2021-08-03 0:36 ` Ben Boeckel
2021-07-31 2:25 ` [PATCH v1 3/4] advice: remove uses of global `advice_` variables Ben Boeckel
2021-08-02 22:06 ` Johannes Schindelin
2021-08-03 0:42 ` Ben Boeckel
2021-07-31 2:25 ` [PATCH v1 4/4] advice: remove static global variables for advice tracking Ben Boeckel
2021-08-02 22:09 ` Johannes Schindelin
2021-08-03 0:44 ` Ben Boeckel
2021-08-02 22:15 ` [PATCH v1 0/4] advice: remove usage of `advice_*` global variables Johannes Schindelin
2021-08-03 0:45 ` Ben Boeckel
2021-08-05 23:03 ` [PATCH v2 " Ben Boeckel
2021-08-05 23:03 ` [PATCH v2 1/4] advice: add enum variants for missing advice variables Ben Boeckel
2021-08-05 23:03 ` [PATCH v2 2/4] advice: remove read uses of global `advice_` variables Ben Boeckel
2021-08-05 23:03 ` [PATCH v2 3/4] advice: add `advice_set` to update advice settings at runtime Ben Boeckel
2021-08-05 23:03 ` [PATCH v2 4/4] advice: remove static global variables for advice tracking Ben Boeckel
2021-08-06 19:13 ` [RFC PATCH v3 0/4] advice: remove usage of `advice_*` global variables Ævar Arnfjörð Bjarmason
2021-08-06 19:13 ` [RFC PATCH v3 1/4] advice: add enum variants for missing advice variables Ævar Arnfjörð Bjarmason
2021-08-06 19:13 ` [RFC PATCH v3 2/4] advice: remove read uses of most global `advice_` variables Ævar Arnfjörð Bjarmason
2021-08-06 19:30 ` Eric Sunshine
2021-08-06 19:13 ` Ævar Arnfjörð Bjarmason [this message]
2021-08-06 20:01 ` [RFC PATCH v3 3/4] advice: remove use of global advice_add_embedded_repo Eric Sunshine
2021-08-06 19:13 ` [RFC PATCH v3 4/4] advice: move advice.graftFileDeprecated squashing to commit.[ch] Ævar Arnfjörð Bjarmason
2021-08-23 10:43 ` [PATCH v4 0/4] advice: remove usage of `advice_*` global variables Ævar Arnfjörð Bjarmason
2021-08-23 10:43 ` [PATCH v4 1/4] advice: add enum variants for missing advice variables Ævar Arnfjörð Bjarmason
2021-08-23 10:44 ` [PATCH v4 2/4] advice: remove read uses of most global `advice_` variables Ævar Arnfjörð Bjarmason
2021-08-23 10:44 ` [PATCH v4 3/4] advice: remove use of global advice_add_embedded_repo Ævar Arnfjörð Bjarmason
2021-08-23 10:44 ` [PATCH v4 4/4] advice: move advice.graftFileDeprecated squashing to commit.[ch] Ævar Arnfjörð Bjarmason
2021-08-25 19:07 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=RFC-patch-v3-3.4-02613d0f30-20210806T191231Z-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mathstuf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).