From 69290551b9a4fa22e76612926e131f926c6c9f11 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 23 Aug 2021 12:43:59 +0200 Subject: advice: add enum variants for missing advice variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In daef1b300b0 (Merge branch 'hw/advice-add-nothing', 2020-02-14), two advice settings were introduced into the `advice_config` array. Subsequently, c4a09cc9ccb (Merge branch 'hw/advise-ng', 2020-03-25) started to deprecate `advice_config` in favor of a new array, `advice_setting`. However, the latter branch did not include the former branch, and therefore `advice_setting` is missing the two entries added by the `hw/advice-add-nothing` branch. These are currently the only entries in `advice_config` missing from `advice_setting`. Signed-off-by: Ben Boeckel Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- advice.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'advice.h') diff --git a/advice.h b/advice.h index 9f8ffc7354..68629b5ba1 100644 --- a/advice.h +++ b/advice.h @@ -45,6 +45,8 @@ extern int advice_add_empty_pathspec; */ enum advice_type { ADVICE_ADD_EMBEDDED_REPO, + ADVICE_ADD_EMPTY_PATHSPEC, + ADVICE_ADD_IGNORED_FILE, ADVICE_AM_WORK_DIR, ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME, ADVICE_COMMIT_BEFORE_MERGE, -- cgit v1.2.3 From ed9bff0817d5a7500b50a39c1c35b44aa3e72578 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 23 Aug 2021 12:44:00 +0200 Subject: advice: remove read uses of most global `advice_` variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In c4a09cc9ccb (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 Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- advice.h | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'advice.h') diff --git a/advice.h b/advice.h index 68629b5ba1..ed51db0f05 100644 --- a/advice.h +++ b/advice.h @@ -5,36 +5,8 @@ struct string_list; -extern int advice_fetch_show_forced_updates; -extern int advice_push_update_rejected; -extern int advice_push_non_ff_current; -extern int advice_push_non_ff_matching; -extern int advice_push_already_exists; -extern int advice_push_fetch_first; -extern int advice_push_needs_force; -extern int advice_push_unqualified_ref_name; -extern int advice_push_ref_needs_update; -extern int advice_status_hints; -extern int advice_status_u_option; -extern int advice_status_ahead_behind_warning; -extern int advice_commit_before_merge; -extern int advice_reset_quiet_warning; -extern int advice_resolve_conflict; -extern int advice_sequencer_in_use; -extern int advice_implicit_identity; -extern int advice_detached_head; -extern int advice_set_upstream_failure; -extern int advice_object_name_warning; -extern int advice_amworkdir; -extern int advice_rm_hints; extern int advice_add_embedded_repo; -extern int advice_ignored_hook; -extern int advice_waiting_for_editor; extern int advice_graft_file_deprecated; -extern int advice_checkout_ambiguous_remote_branch_name; -extern int advice_submodule_alternate_error_strategy_die; -extern int advice_add_ignored_file; -extern int advice_add_empty_pathspec; /* * To add a new advice, you need to: -- cgit v1.2.3 From c2a4b6d4ee4f7f52521c1c36d63744f1a3c08d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 23 Aug 2021 12:44:01 +0200 Subject: advice: remove use of global advice_add_embedded_repo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 shown advice in check_embedded_repo() than setting the global variable. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- advice.h | 1 - 1 file changed, 1 deletion(-) (limited to 'advice.h') 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; /* -- cgit v1.2.3 From ab628588f80e8dd889b700515c41548c1a356dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 23 Aug 2021 12:44:02 +0200 Subject: advice: move advice.graftFileDeprecated squashing to commit.[ch] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the squashing of the advice.graftFileDeprecated advice over to an external variable in commit.[ch], allowing advice() to purely use the new-style API of invoking advice() with an enum. See 8821e90a09a (advice: don't pointlessly suggest --convert-graft-file, 2018-11-27) for why quieting this advice was needed. It's more straightforward to move this code to commit.[ch] and use it builtin/replace.c, than to go through the indirection of advice.[ch]. Because this was the last advice_config variable we can remove that old facility from advice.c. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- advice.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'advice.h') diff --git a/advice.h b/advice.h index 4b754f4c62..e380a0562e 100644 --- a/advice.h +++ b/advice.h @@ -5,8 +5,6 @@ struct string_list; -extern int advice_graft_file_deprecated; - /* * To add a new advice, you need to: * Define a new advice_type. -- cgit v1.2.3