From: Junio C Hamano Date: Wed, 25 Mar 2020 20:57:41 +0000 (-0700) Subject: Merge branch 'hw/advise-ng' X-Git-Tag: v2.27.0-rc0~170 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c4a09cc9ccb63090b78a4d9529462151df62d73d;p=thirdparty%2Fgit.git Merge branch 'hw/advise-ng' Revamping of the advise API to allow more systematic enumeration of advice knobs in the future. * hw/advise-ng: tag: use new advice API to check visibility advice: revamp advise API advice: change "setupStreamFailure" to "setUpstreamFailure" advice: extract vadvise() from advise() --- c4a09cc9ccb63090b78a4d9529462151df62d73d diff --cc advice.c index 97f3f981b4,ef4bef65d8..f0a3d32d20 --- a/advice.c +++ b/advice.c @@@ -29,10 -29,7 +29,9 @@@ int advice_ignored_hook = 1 int advice_waiting_for_editor = 1; int advice_graft_file_deprecated = 1; int advice_checkout_ambiguous_remote_branch_name = 1; - int advice_nested_tag = 1; int advice_submodule_alternate_error_strategy_die = 1; +int advice_add_ignored_file = 1; +int advice_add_empty_pathspec = 1; static int advice_use_color = -1; static char advice_colors[][COLOR_MAXLEN] = { @@@ -91,10 -88,7 +90,9 @@@ static struct { "waitingForEditor", &advice_waiting_for_editor }, { "graftFileDeprecated", &advice_graft_file_deprecated }, { "checkoutAmbiguousRemoteBranchName", &advice_checkout_ambiguous_remote_branch_name }, - { "nestedTag", &advice_nested_tag }, { "submoduleAlternateErrorStrategyDie", &advice_submodule_alternate_error_strategy_die }, + { "addIgnoredFile", &advice_add_ignored_file }, + { "addEmptyPathspec", &advice_add_empty_pathspec }, /* make this an alias for backward compatibility */ { "pushNonFastForward", &advice_push_update_rejected } diff --cc advice.h index 0e6e58d9f8,77cbe5c6b3..16f2c11642 --- a/advice.h +++ b/advice.h @@@ -29,11 -29,47 +29,49 @@@ 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_nested_tag; 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: + * Define a new advice_type. + * Add a new entry to advice_setting array. + * Add the new config variable to Documentation/config/advice.txt. + * Call advise_if_enabled to print your advice. + */ + enum advice_type { + ADVICE_ADD_EMBEDDED_REPO, + ADVICE_AM_WORK_DIR, + ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME, + ADVICE_COMMIT_BEFORE_MERGE, + ADVICE_DETACHED_HEAD, + ADVICE_FETCH_SHOW_FORCED_UPDATES, + ADVICE_GRAFT_FILE_DEPRECATED, + ADVICE_IGNORED_HOOK, + ADVICE_IMPLICIT_IDENTITY, + ADVICE_NESTED_TAG, + ADVICE_OBJECT_NAME_WARNING, + ADVICE_PUSH_ALREADY_EXISTS, + ADVICE_PUSH_FETCH_FIRST, + ADVICE_PUSH_NEEDS_FORCE, + ADVICE_PUSH_NON_FF_CURRENT, + ADVICE_PUSH_NON_FF_MATCHING, + ADVICE_PUSH_UNQUALIFIED_REF_NAME, + ADVICE_PUSH_UPDATE_REJECTED_ALIAS, + ADVICE_PUSH_UPDATE_REJECTED, + ADVICE_RESET_QUIET_WARNING, + ADVICE_RESOLVE_CONFLICT, + ADVICE_RM_HINTS, + ADVICE_SEQUENCER_IN_USE, + ADVICE_SET_UPSTREAM_FAILURE, + ADVICE_STATUS_AHEAD_BEHIND_WARNING, + ADVICE_STATUS_HINTS, + ADVICE_STATUS_U_OPTION, + ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE, + ADVICE_WAITING_FOR_EDITOR, + }; + int git_default_advice_config(const char *var, const char *value); __attribute__((format (printf, 1, 2))) void advise(const char *advice, ...);