Jeff King | 7519443 | 2009-09-09 07:38:58 -0400 | [diff] [blame] | 1 | #ifndef ADVICE_H |
| 2 | #define ADVICE_H |
| 3 | |
Matthieu Moy | d38a30d | 2010-01-12 10:54:44 +0100 | [diff] [blame] | 4 | #include "git-compat-util.h" |
| 5 | |
Derrick Stolee | 377444b | 2019-06-18 13:25:27 -0700 | [diff] [blame] | 6 | extern int advice_fetch_show_forced_updates; |
Chris Rorvick | 1184564 | 2012-12-02 21:27:50 -0600 | [diff] [blame] | 7 | extern int advice_push_update_rejected; |
Christopher Tiwald | f25950f | 2012-03-20 00:31:33 -0400 | [diff] [blame] | 8 | extern int advice_push_non_ff_current; |
Christopher Tiwald | f25950f | 2012-03-20 00:31:33 -0400 | [diff] [blame] | 9 | extern int advice_push_non_ff_matching; |
Chris Rorvick | b450568 | 2012-12-02 21:27:51 -0600 | [diff] [blame] | 10 | extern int advice_push_already_exists; |
Junio C Hamano | 75e5c0d | 2013-01-23 13:55:30 -0800 | [diff] [blame] | 11 | extern int advice_push_fetch_first; |
| 12 | extern int advice_push_needs_force; |
Ævar Arnfjörð Bjarmason | dd8dd30 | 2018-11-13 19:52:43 +0000 | [diff] [blame] | 13 | extern int advice_push_unqualified_ref_name; |
Srinidhi Kaushik | 3b990aa | 2020-10-03 17:40:45 +0530 | [diff] [blame] | 14 | extern int advice_push_ref_needs_update; |
Jeff King | edf563f | 2009-09-09 07:43:03 -0400 | [diff] [blame] | 15 | extern int advice_status_hints; |
Nguyễn Thái Ngọc Duy | 6a38ef2 | 2013-03-13 19:59:16 +0700 | [diff] [blame] | 16 | extern int advice_status_u_option; |
Jeff Hostetler | 0a53561 | 2019-06-18 13:21:27 -0700 | [diff] [blame] | 17 | extern int advice_status_ahead_behind_warning; |
Matthieu Moy | 4c371f9 | 2009-11-22 23:26:17 +0100 | [diff] [blame] | 18 | extern int advice_commit_before_merge; |
Ben Peart | 649bf3a | 2018-10-23 15:04:23 -0400 | [diff] [blame] | 19 | extern int advice_reset_quiet_warning; |
Matthieu Moy | d38a30d | 2010-01-12 10:54:44 +0100 | [diff] [blame] | 20 | extern int advice_resolve_conflict; |
Rohit Ashiwal | 6a1f904 | 2019-07-02 14:41:25 +0530 | [diff] [blame] | 21 | extern int advice_sequencer_in_use; |
Jeff King | b706fcf | 2010-01-13 15:17:08 -0500 | [diff] [blame] | 22 | extern int advice_implicit_identity; |
Junio C Hamano | 13be3e3 | 2010-01-29 22:03:24 -0800 | [diff] [blame] | 23 | extern int advice_detached_head; |
Jeff King | caa2036 | 2013-04-02 15:05:12 -0400 | [diff] [blame] | 24 | extern int advice_set_upstream_failure; |
Nguyễn Thái Ngọc Duy | 798c35f | 2013-05-29 19:12:42 +0700 | [diff] [blame] | 25 | extern int advice_object_name_warning; |
Nguyễn Thái Ngọc Duy | 431bb23 | 2018-05-26 15:55:27 +0200 | [diff] [blame] | 26 | extern int advice_amworkdir; |
Mathieu Lienard--Mayor | 7e30944 | 2013-06-12 10:06:44 +0200 | [diff] [blame] | 27 | extern int advice_rm_hints; |
Jeff King | 5321399 | 2017-06-14 06:58:22 -0400 | [diff] [blame] | 28 | extern int advice_add_embedded_repo; |
Damien Marié | f805a00 | 2017-10-06 08:07:55 +0000 | [diff] [blame] | 29 | extern int advice_ignored_hook; |
Lars Schneider | abfb04d | 2017-12-07 16:16:41 +0100 | [diff] [blame] | 30 | extern int advice_waiting_for_editor; |
Johannes Schindelin | f9f99b3 | 2018-04-29 00:44:44 +0200 | [diff] [blame] | 31 | extern int advice_graft_file_deprecated; |
Ævar Arnfjörð Bjarmason | ad8d510 | 2018-06-05 14:40:48 +0000 | [diff] [blame] | 32 | extern int advice_checkout_ambiguous_remote_branch_name; |
Jonathan Tan | 4f3e57e | 2019-12-02 11:57:52 -0800 | [diff] [blame] | 33 | extern int advice_submodule_alternate_error_strategy_die; |
Heba Waly | 887a0fd | 2020-02-06 23:57:30 +1300 | [diff] [blame] | 34 | extern int advice_add_ignored_file; |
| 35 | extern int advice_add_empty_pathspec; |
Jeff King | 7519443 | 2009-09-09 07:38:58 -0400 | [diff] [blame] | 36 | |
Heba Waly | b3b18d1 | 2020-03-02 20:01:59 +0000 | [diff] [blame] | 37 | /* |
| 38 | * To add a new advice, you need to: |
| 39 | * Define a new advice_type. |
| 40 | * Add a new entry to advice_setting array. |
| 41 | * Add the new config variable to Documentation/config/advice.txt. |
| 42 | * Call advise_if_enabled to print your advice. |
| 43 | */ |
| 44 | enum advice_type { |
| 45 | ADVICE_ADD_EMBEDDED_REPO, |
| 46 | ADVICE_AM_WORK_DIR, |
| 47 | ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME, |
| 48 | ADVICE_COMMIT_BEFORE_MERGE, |
| 49 | ADVICE_DETACHED_HEAD, |
| 50 | ADVICE_FETCH_SHOW_FORCED_UPDATES, |
| 51 | ADVICE_GRAFT_FILE_DEPRECATED, |
| 52 | ADVICE_IGNORED_HOOK, |
| 53 | ADVICE_IMPLICIT_IDENTITY, |
| 54 | ADVICE_NESTED_TAG, |
| 55 | ADVICE_OBJECT_NAME_WARNING, |
| 56 | ADVICE_PUSH_ALREADY_EXISTS, |
| 57 | ADVICE_PUSH_FETCH_FIRST, |
| 58 | ADVICE_PUSH_NEEDS_FORCE, |
| 59 | ADVICE_PUSH_NON_FF_CURRENT, |
| 60 | ADVICE_PUSH_NON_FF_MATCHING, |
| 61 | ADVICE_PUSH_UNQUALIFIED_REF_NAME, |
| 62 | ADVICE_PUSH_UPDATE_REJECTED_ALIAS, |
| 63 | ADVICE_PUSH_UPDATE_REJECTED, |
Srinidhi Kaushik | 3b990aa | 2020-10-03 17:40:45 +0530 | [diff] [blame] | 64 | ADVICE_PUSH_REF_NEEDS_UPDATE, |
Heba Waly | b3b18d1 | 2020-03-02 20:01:59 +0000 | [diff] [blame] | 65 | ADVICE_RESET_QUIET_WARNING, |
| 66 | ADVICE_RESOLVE_CONFLICT, |
| 67 | ADVICE_RM_HINTS, |
| 68 | ADVICE_SEQUENCER_IN_USE, |
| 69 | ADVICE_SET_UPSTREAM_FAILURE, |
| 70 | ADVICE_STATUS_AHEAD_BEHIND_WARNING, |
| 71 | ADVICE_STATUS_HINTS, |
| 72 | ADVICE_STATUS_U_OPTION, |
| 73 | ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE, |
| 74 | ADVICE_WAITING_FOR_EDITOR, |
| 75 | }; |
| 76 | |
Jeff King | 7519443 | 2009-09-09 07:38:58 -0400 | [diff] [blame] | 77 | int git_default_advice_config(const char *var, const char *value); |
Jeff King | 4621085 | 2013-07-09 20:18:40 -0400 | [diff] [blame] | 78 | __attribute__((format (printf, 1, 2))) |
Ramkumar Ramachandra | 38ef61c | 2011-08-04 16:08:59 +0530 | [diff] [blame] | 79 | void advise(const char *advice, ...); |
Heba Waly | b3b18d1 | 2020-03-02 20:01:59 +0000 | [diff] [blame] | 80 | |
| 81 | /** |
| 82 | * Checks if advice type is enabled (can be printed to the user). |
| 83 | * Should be called before advise(). |
| 84 | */ |
| 85 | int advice_enabled(enum advice_type type); |
| 86 | |
| 87 | /** |
| 88 | * Checks the visibility of the advice before printing. |
| 89 | */ |
| 90 | void advise_if_enabled(enum advice_type type, const char *advice, ...); |
| 91 | |
Ramkumar Ramachandra | 38ef61c | 2011-08-04 16:08:59 +0530 | [diff] [blame] | 92 | int error_resolve_conflict(const char *me); |
Denton Liu | 5545442 | 2019-04-29 04:28:14 -0400 | [diff] [blame] | 93 | void NORETURN die_resolve_conflict(const char *me); |
Paul Tan | 4a4cf9e | 2015-06-18 18:54:04 +0800 | [diff] [blame] | 94 | void NORETURN die_conclude_merge(void); |
Nguyễn Thái Ngọc Duy | 2857093 | 2012-01-16 16:46:16 +0700 | [diff] [blame] | 95 | void detach_advice(const char *new_name); |
Matthieu Moy | d38a30d | 2010-01-12 10:54:44 +0100 | [diff] [blame] | 96 | |
Jeff King | 7519443 | 2009-09-09 07:38:58 -0400 | [diff] [blame] | 97 | #endif /* ADVICE_H */ |