advice: remove use of global advice_add_embedded_repo
The external use of this variable was added in 532139940c
(add: warn
when adding an embedded repository, 2017-06-14). For the use-case it's
more straightforward to track whether we've shown advice in
check_embedded_repo() than setting the global variable.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
ed9bff0817
commit
c2a4b6d4ee
2
advice.c
2
advice.c
@ -4,7 +4,6 @@
|
|||||||
#include "help.h"
|
#include "help.h"
|
||||||
#include "string-list.h"
|
#include "string-list.h"
|
||||||
|
|
||||||
int advice_add_embedded_repo = 1;
|
|
||||||
int advice_graft_file_deprecated = 1;
|
int advice_graft_file_deprecated = 1;
|
||||||
|
|
||||||
static int advice_use_color = -1;
|
static int advice_use_color = -1;
|
||||||
@ -38,7 +37,6 @@ static struct {
|
|||||||
const char *name;
|
const char *name;
|
||||||
int *preference;
|
int *preference;
|
||||||
} advice_config[] = {
|
} advice_config[] = {
|
||||||
{ "addEmbeddedRepo", &advice_add_embedded_repo },
|
|
||||||
{ "graftFileDeprecated", &advice_graft_file_deprecated },
|
{ "graftFileDeprecated", &advice_graft_file_deprecated },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
1
advice.h
1
advice.h
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
struct string_list;
|
struct string_list;
|
||||||
|
|
||||||
extern int advice_add_embedded_repo;
|
|
||||||
extern int advice_graft_file_deprecated;
|
extern int advice_graft_file_deprecated;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -419,6 +419,7 @@ static const char embedded_advice[] = N_(
|
|||||||
static void check_embedded_repo(const char *path)
|
static void check_embedded_repo(const char *path)
|
||||||
{
|
{
|
||||||
struct strbuf name = STRBUF_INIT;
|
struct strbuf name = STRBUF_INIT;
|
||||||
|
static int adviced_on_embedded_repo = 0;
|
||||||
|
|
||||||
if (!warn_on_embedded_repo)
|
if (!warn_on_embedded_repo)
|
||||||
return;
|
return;
|
||||||
@ -430,10 +431,10 @@ static void check_embedded_repo(const char *path)
|
|||||||
strbuf_strip_suffix(&name, "/");
|
strbuf_strip_suffix(&name, "/");
|
||||||
|
|
||||||
warning(_("adding embedded git repository: %s"), name.buf);
|
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);
|
advise(embedded_advice, name.buf, name.buf);
|
||||||
/* there may be multiple entries; advise only once */
|
adviced_on_embedded_repo = 1;
|
||||||
advice_add_embedded_repo = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_release(&name);
|
strbuf_release(&name);
|
||||||
|
Reference in New Issue
Block a user