advice: remove read uses of most global advice_ variables
In c4a09cc9cc (Merge branch 'hw/advise-ng', 2020-03-25), a new API for
accessing advice variables was introduced and deprecated `advice_config`
in favor of a new array, `advice_setting`.
This patch ports all but two uses which read the status of the global
`advice_` variables over to the new `advice_enabled` API. We'll deal
with advice_add_embedded_repo and advice_graft_file_deprecated
separately.
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
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
69290551b9
commit
ed9bff0817
@ -111,17 +111,17 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
||||
strvec_init(&opts->msgs_to_free);
|
||||
|
||||
if (!strcmp(cmd, "checkout"))
|
||||
msg = advice_commit_before_merge
|
||||
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||
? _("Your local changes to the following files would be overwritten by checkout:\n%%s"
|
||||
"Please commit your changes or stash them before you switch branches.")
|
||||
: _("Your local changes to the following files would be overwritten by checkout:\n%%s");
|
||||
else if (!strcmp(cmd, "merge"))
|
||||
msg = advice_commit_before_merge
|
||||
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||
? _("Your local changes to the following files would be overwritten by merge:\n%%s"
|
||||
"Please commit your changes or stash them before you merge.")
|
||||
: _("Your local changes to the following files would be overwritten by merge:\n%%s");
|
||||
else
|
||||
msg = advice_commit_before_merge
|
||||
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||
? _("Your local changes to the following files would be overwritten by %s:\n%%s"
|
||||
"Please commit your changes or stash them before you %s.")
|
||||
: _("Your local changes to the following files would be overwritten by %s:\n%%s");
|
||||
@ -132,17 +132,17 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
||||
_("Updating the following directories would lose untracked files in them:\n%s");
|
||||
|
||||
if (!strcmp(cmd, "checkout"))
|
||||
msg = advice_commit_before_merge
|
||||
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||
? _("The following untracked working tree files would be removed by checkout:\n%%s"
|
||||
"Please move or remove them before you switch branches.")
|
||||
: _("The following untracked working tree files would be removed by checkout:\n%%s");
|
||||
else if (!strcmp(cmd, "merge"))
|
||||
msg = advice_commit_before_merge
|
||||
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||
? _("The following untracked working tree files would be removed by merge:\n%%s"
|
||||
"Please move or remove them before you merge.")
|
||||
: _("The following untracked working tree files would be removed by merge:\n%%s");
|
||||
else
|
||||
msg = advice_commit_before_merge
|
||||
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||
? _("The following untracked working tree files would be removed by %s:\n%%s"
|
||||
"Please move or remove them before you %s.")
|
||||
: _("The following untracked working tree files would be removed by %s:\n%%s");
|
||||
@ -150,17 +150,17 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
||||
strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd);
|
||||
|
||||
if (!strcmp(cmd, "checkout"))
|
||||
msg = advice_commit_before_merge
|
||||
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||
? _("The following untracked working tree files would be overwritten by checkout:\n%%s"
|
||||
"Please move or remove them before you switch branches.")
|
||||
: _("The following untracked working tree files would be overwritten by checkout:\n%%s");
|
||||
else if (!strcmp(cmd, "merge"))
|
||||
msg = advice_commit_before_merge
|
||||
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||
? _("The following untracked working tree files would be overwritten by merge:\n%%s"
|
||||
"Please move or remove them before you merge.")
|
||||
: _("The following untracked working tree files would be overwritten by merge:\n%%s");
|
||||
else
|
||||
msg = advice_commit_before_merge
|
||||
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||
? _("The following untracked working tree files would be overwritten by %s:\n%%s"
|
||||
"Please move or remove them before you %s.")
|
||||
: _("The following untracked working tree files would be overwritten by %s:\n%%s");
|
||||
|
||||
Reference in New Issue
Block a user