mirror of
https://github.com/git/git.git
synced 2026-01-11 13:23:12 +09:00
Since 1296cbe4b46 (init: document `init.defaultBranch` better, 2020-12-11) "git-init.adoc" has advertised that the default name of the initial branch may change in the future. The name "main" is chosen to match the default used by the big Git forge web sites. The advice printed when init.defaultBranch is not set is updated to say that the default will change to "main" in Git 3.0. Building with WITH_BREAKING_CHANGES enabled removes the advice and changes the default branch name to "main". The code in guess_remote_head() that looks for "refs/heads/master" is left unchanged as that is only called when the remote server does not support the symref capability in the v0 protocol or the symref extension to the ls-refs list in the v2 protocol. Such an old server is more likely to be using "master" as the default branch name. With the exception of the "git-init.adoc" the documentation is left unchanged. I had hoped to parameterize the name of the default branch by using an asciidoc attribute. Unfortunately attribute expansion is inhibited by backticks and we use backticks to mark up ref names so that idea does not work. As the changes to git-init.adoc show inserting ifdef's around each instance of the branch name "master" is cumbersome and makes the documentation sources harder to read. Apart from "git-init.adoc" there are some other files where "master" is used as the name of the initial branch rather than as an example of a branch name such as "user-manual.adoc" and "gitcore-tutorial.adoc". The name appears a lot in those so updating it with ifdef's is not really practical. We can update that document in the 3.0 release cycle. The other documentation where master is used as an example branch name can be gradually converted over time. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
90 lines
2.5 KiB
C
90 lines
2.5 KiB
C
#ifndef ADVICE_H
|
|
#define ADVICE_H
|
|
|
|
struct string_list;
|
|
|
|
/*
|
|
* 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.adoc.
|
|
* Call advise_if_enabled to print your advice.
|
|
*/
|
|
enum advice_type {
|
|
ADVICE_ADD_EMBEDDED_REPO,
|
|
ADVICE_ADD_EMPTY_PATHSPEC,
|
|
ADVICE_ADD_IGNORED_FILE,
|
|
ADVICE_AMBIGUOUS_FETCH_REFSPEC,
|
|
ADVICE_AM_WORK_DIR,
|
|
ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
|
|
ADVICE_COMMIT_BEFORE_MERGE,
|
|
#ifndef WITH_BREAKING_CHANGES
|
|
ADVICE_DEFAULT_BRANCH_NAME,
|
|
#endif /* WITH_BREAKING_CHANGES */
|
|
ADVICE_DETACHED_HEAD,
|
|
ADVICE_DIVERGING,
|
|
ADVICE_FETCH_SET_HEAD_WARN,
|
|
ADVICE_FETCH_SHOW_FORCED_UPDATES,
|
|
ADVICE_FORCE_DELETE_BRANCH,
|
|
ADVICE_GRAFT_FILE_DEPRECATED,
|
|
ADVICE_IGNORED_HOOK,
|
|
ADVICE_IMPLICIT_IDENTITY,
|
|
ADVICE_MERGE_CONFLICT,
|
|
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_REF_NEEDS_UPDATE,
|
|
ADVICE_PUSH_UNQUALIFIED_REF_NAME,
|
|
ADVICE_PUSH_UPDATE_REJECTED,
|
|
ADVICE_PUSH_UPDATE_REJECTED_ALIAS,
|
|
ADVICE_REBASE_TODO_ERROR,
|
|
ADVICE_REF_SYNTAX,
|
|
ADVICE_RESET_NO_REFRESH_WARNING,
|
|
ADVICE_RESOLVE_CONFLICT,
|
|
ADVICE_RM_HINTS,
|
|
ADVICE_SEQUENCER_IN_USE,
|
|
ADVICE_SET_UPSTREAM_FAILURE,
|
|
ADVICE_SKIPPED_CHERRY_PICKS,
|
|
ADVICE_SPARSE_INDEX_EXPANDED,
|
|
ADVICE_STATUS_AHEAD_BEHIND_WARNING,
|
|
ADVICE_STATUS_HINTS,
|
|
ADVICE_STATUS_U_OPTION,
|
|
ADVICE_SUBMODULES_NOT_UPDATED,
|
|
ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE,
|
|
ADVICE_SUBMODULE_MERGE_CONFLICT,
|
|
ADVICE_SUGGEST_DETACHING_HEAD,
|
|
ADVICE_UPDATE_SPARSE_PATH,
|
|
ADVICE_WAITING_FOR_EDITOR,
|
|
ADVICE_WORKTREE_ADD_ORPHAN,
|
|
};
|
|
|
|
int git_default_advice_config(const char *var, const char *value);
|
|
__attribute__((format (printf, 1, 2)))
|
|
void advise(const char *advice, ...);
|
|
|
|
/**
|
|
* Checks if advice type is enabled (can be printed to the user).
|
|
* Should be called before advise().
|
|
*/
|
|
int advice_enabled(enum advice_type type);
|
|
|
|
/**
|
|
* Checks the visibility of the advice before printing.
|
|
*/
|
|
__attribute__((format (printf, 2, 3)))
|
|
void advise_if_enabled(enum advice_type type, const char *advice, ...);
|
|
|
|
int error_resolve_conflict(const char *me);
|
|
void NORETURN die_resolve_conflict(const char *me);
|
|
void NORETURN die_conclude_merge(void);
|
|
void NORETURN die_ff_impossible(void);
|
|
void advise_on_updating_sparse_paths(struct string_list *pathspec_list);
|
|
void detach_advice(const char *new_name);
|
|
void advise_on_moving_dirty_path(struct string_list *pathspec_list);
|
|
|
|
#endif /* ADVICE_H */
|