git: fix leaking system paths
[git/gitster.git] / advice.h
blobd7466bc0ef20264fb475d57e408abca5ca81fad4
1 #ifndef ADVICE_H
2 #define ADVICE_H
4 struct string_list;
6 /*
7 * To add a new advice, you need to:
8 * Define a new advice_type.
9 * Add a new entry to advice_setting array.
10 * Add the new config variable to Documentation/config/advice.txt.
11 * Call advise_if_enabled to print your advice.
13 enum advice_type {
14 ADVICE_ADD_EMBEDDED_REPO,
15 ADVICE_ADD_EMPTY_PATHSPEC,
16 ADVICE_ADD_IGNORED_FILE,
17 ADVICE_AMBIGUOUS_FETCH_REFSPEC,
18 ADVICE_AM_WORK_DIR,
19 ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
20 ADVICE_COMMIT_BEFORE_MERGE,
21 ADVICE_DETACHED_HEAD,
22 ADVICE_DIVERGING,
23 ADVICE_FETCH_SHOW_FORCED_UPDATES,
24 ADVICE_FORCE_DELETE_BRANCH,
25 ADVICE_GRAFT_FILE_DEPRECATED,
26 ADVICE_IGNORED_HOOK,
27 ADVICE_IMPLICIT_IDENTITY,
28 ADVICE_MERGE_CONFLICT,
29 ADVICE_NESTED_TAG,
30 ADVICE_OBJECT_NAME_WARNING,
31 ADVICE_PUSH_ALREADY_EXISTS,
32 ADVICE_PUSH_FETCH_FIRST,
33 ADVICE_PUSH_NEEDS_FORCE,
34 ADVICE_PUSH_NON_FF_CURRENT,
35 ADVICE_PUSH_NON_FF_MATCHING,
36 ADVICE_PUSH_REF_NEEDS_UPDATE,
37 ADVICE_PUSH_UNQUALIFIED_REF_NAME,
38 ADVICE_PUSH_UPDATE_REJECTED,
39 ADVICE_PUSH_UPDATE_REJECTED_ALIAS,
40 ADVICE_REBASE_TODO_ERROR,
41 ADVICE_REF_SYNTAX,
42 ADVICE_RESET_NO_REFRESH_WARNING,
43 ADVICE_RESOLVE_CONFLICT,
44 ADVICE_RM_HINTS,
45 ADVICE_SEQUENCER_IN_USE,
46 ADVICE_SET_UPSTREAM_FAILURE,
47 ADVICE_SKIPPED_CHERRY_PICKS,
48 ADVICE_SPARSE_INDEX_EXPANDED,
49 ADVICE_STATUS_AHEAD_BEHIND_WARNING,
50 ADVICE_STATUS_HINTS,
51 ADVICE_STATUS_U_OPTION,
52 ADVICE_SUBMODULES_NOT_UPDATED,
53 ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE,
54 ADVICE_SUBMODULE_MERGE_CONFLICT,
55 ADVICE_SUGGEST_DETACHING_HEAD,
56 ADVICE_UPDATE_SPARSE_PATH,
57 ADVICE_WAITING_FOR_EDITOR,
58 ADVICE_WORKTREE_ADD_ORPHAN,
61 int git_default_advice_config(const char *var, const char *value);
62 __attribute__((format (printf, 1, 2)))
63 void advise(const char *advice, ...);
65 /**
66 * Checks if advice type is enabled (can be printed to the user).
67 * Should be called before advise().
69 int advice_enabled(enum advice_type type);
71 /**
72 * Checks the visibility of the advice before printing.
74 __attribute__((format (printf, 2, 3)))
75 void advise_if_enabled(enum advice_type type, const char *advice, ...);
77 int error_resolve_conflict(const char *me);
78 void NORETURN die_resolve_conflict(const char *me);
79 void NORETURN die_conclude_merge(void);
80 void NORETURN die_ff_impossible(void);
81 void advise_on_updating_sparse_paths(struct string_list *pathspec_list);
82 void detach_advice(const char *new_name);
83 void advise_on_moving_dirty_path(struct string_list *pathspec_list);
85 #endif /* ADVICE_H */