2009-09-09 15:38:58 +04:00
|
|
|
#ifndef ADVICE_H
|
|
|
|
#define ADVICE_H
|
|
|
|
|
2021-04-08 23:41:27 +03:00
|
|
|
struct string_list;
|
|
|
|
|
2020-03-02 23:01:59 +03:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
advice: fix an unexpected leading space
This space was introduced, presumably unintentionally, in b3b18d1621
(advice: revamp advise API, 2020-03-02)
I notice this space due to confuse diff outputs while doing some
changes to enum advice_type.
As a reference, a recent change we have to that enum is:
$ git show 35f0383
...
diff --git a/advice.h b/advice.h
index 0f584163f5..2affbe1426 100644
--- a/advice.h
+++ b/advice.h
@@ -49,6 +49,7 @@ struct string_list;
ADVICE_UPDATE_SPARSE_PATH,
ADVICE_WAITING_FOR_EDITOR,
ADVICE_SKIPPED_CHERRY_PICKS,
+ ADVICE_WORKTREE_ADD_ORPHAN,
};
Note the hunk header, instead of a much more expected:
@@ -49,6 +49,7 @@ enum advice_type
Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-01-11 15:40:17 +03:00
|
|
|
enum advice_type {
|
2020-03-02 23:01:59 +03:00
|
|
|
ADVICE_ADD_EMBEDDED_REPO,
|
2021-08-23 13:43:59 +03:00
|
|
|
ADVICE_ADD_EMPTY_PATHSPEC,
|
|
|
|
ADVICE_ADD_IGNORED_FILE,
|
2022-04-01 09:05:13 +03:00
|
|
|
ADVICE_AMBIGUOUS_FETCH_REFSPEC,
|
2024-01-11 15:40:01 +03:00
|
|
|
ADVICE_AM_WORK_DIR,
|
2020-03-02 23:01:59 +03:00
|
|
|
ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
|
|
|
|
ADVICE_COMMIT_BEFORE_MERGE,
|
|
|
|
ADVICE_DETACHED_HEAD,
|
2023-03-08 05:48:33 +03:00
|
|
|
ADVICE_DIVERGING,
|
2020-03-02 23:01:59 +03:00
|
|
|
ADVICE_FETCH_SHOW_FORCED_UPDATES,
|
2024-01-11 15:40:34 +03:00
|
|
|
ADVICE_FORCE_DELETE_BRANCH,
|
2020-03-02 23:01:59 +03:00
|
|
|
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,
|
2024-01-11 15:40:01 +03:00
|
|
|
ADVICE_PUSH_REF_NEEDS_UPDATE,
|
2020-03-02 23:01:59 +03:00
|
|
|
ADVICE_PUSH_UNQUALIFIED_REF_NAME,
|
|
|
|
ADVICE_PUSH_UPDATE_REJECTED,
|
2024-01-11 15:40:01 +03:00
|
|
|
ADVICE_PUSH_UPDATE_REJECTED_ALIAS,
|
2022-03-15 04:49:40 +03:00
|
|
|
ADVICE_RESET_NO_REFRESH_WARNING,
|
2020-03-02 23:01:59 +03:00
|
|
|
ADVICE_RESOLVE_CONFLICT,
|
|
|
|
ADVICE_RM_HINTS,
|
|
|
|
ADVICE_SEQUENCER_IN_USE,
|
|
|
|
ADVICE_SET_UPSTREAM_FAILURE,
|
2024-01-11 15:40:01 +03:00
|
|
|
ADVICE_SKIPPED_CHERRY_PICKS,
|
2020-03-02 23:01:59 +03:00
|
|
|
ADVICE_STATUS_AHEAD_BEHIND_WARNING,
|
|
|
|
ADVICE_STATUS_HINTS,
|
|
|
|
ADVICE_STATUS_U_OPTION,
|
branch: add --recurse-submodules option for branch creation
To improve the submodules UX, we would like to teach Git to handle
branches in submodules. Start this process by teaching "git branch" the
--recurse-submodules option so that "git branch --recurse-submodules
topic" will create the `topic` branch in the superproject and its
submodules.
Although this commit does not introduce breaking changes, it does not
work well with existing --recurse-submodules commands because "git
branch --recurse-submodules" writes to the submodule ref store, but most
commands only consider the superproject gitlink and ignore the submodule
ref store. For example, "git checkout --recurse-submodules" will check
out the commits in the superproject gitlinks (and put the submodules in
detached HEAD) instead of checking out the submodule branches.
Because of this, this commit introduces a new configuration value,
`submodule.propagateBranches`. The plan is for Git commands to
prioritize submodule ref store information over superproject gitlinks if
this value is true. Because "git branch --recurse-submodules" writes to
submodule ref stores, for the sake of clarity, it will not function
unless this configuration value is set.
This commit also includes changes that support working with submodules
from a superproject commit because "branch --recurse-submodules" (and
future commands) need to read .gitmodules and gitlinks from the
superproject commit, but submodules are typically read from the
filesystem's .gitmodules and the index's gitlinks. These changes are:
* add a submodules_of_tree() helper that gives the relevant
information of an in-tree submodule (e.g. path and oid) and
initializes the repository
* add is_tree_submodule_active() by adding a treeish_name parameter to
is_submodule_active()
* add the "submoduleNotUpdated" advice to advise users to update the
submodules in their trees
Incidentally, fix an incorrect usage string that combined the 'list'
usage of git branch (-l) with the 'create' usage; this string has been
incorrect since its inception, a8dfd5eac4 (Make builtin-branch.c use
parse_options., 2007-10-07).
Helped-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Glen Choo <chooglen@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-01-29 03:04:45 +03:00
|
|
|
ADVICE_SUBMODULES_NOT_UPDATED,
|
2024-01-11 15:40:01 +03:00
|
|
|
ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE,
|
|
|
|
ADVICE_SUGGEST_DETACHING_HEAD,
|
2021-04-08 23:41:27 +03:00
|
|
|
ADVICE_UPDATE_SPARSE_PATH,
|
2020-03-02 23:01:59 +03:00
|
|
|
ADVICE_WAITING_FOR_EDITOR,
|
2023-05-18 00:48:52 +03:00
|
|
|
ADVICE_WORKTREE_ADD_ORPHAN,
|
2020-03-02 23:01:59 +03:00
|
|
|
};
|
|
|
|
|
2009-09-09 15:38:58 +04:00
|
|
|
int git_default_advice_config(const char *var, const char *value);
|
2013-07-10 04:18:40 +04:00
|
|
|
__attribute__((format (printf, 1, 2)))
|
2011-08-04 14:38:59 +04:00
|
|
|
void advise(const char *advice, ...);
|
2020-03-02 23:01:59 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2021-07-13 11:05:20 +03:00
|
|
|
__attribute__((format (printf, 2, 3)))
|
2020-03-02 23:01:59 +03:00
|
|
|
void advise_if_enabled(enum advice_type type, const char *advice, ...);
|
|
|
|
|
2011-08-04 14:38:59 +04:00
|
|
|
int error_resolve_conflict(const char *me);
|
2019-04-29 11:28:14 +03:00
|
|
|
void NORETURN die_resolve_conflict(const char *me);
|
2015-06-18 13:54:04 +03:00
|
|
|
void NORETURN die_conclude_merge(void);
|
2021-07-21 04:42:19 +03:00
|
|
|
void NORETURN die_ff_impossible(void);
|
2021-04-08 23:41:27 +03:00
|
|
|
void advise_on_updating_sparse_paths(struct string_list *pathspec_list);
|
2012-01-16 13:46:16 +04:00
|
|
|
void detach_advice(const char *new_name);
|
2022-08-09 15:09:09 +03:00
|
|
|
void advise_on_moving_dirty_path(struct string_list *pathspec_list);
|
Be more user-friendly when refusing to do something because of conflict.
Various commands refuse to run in the presence of conflicts (commit,
merge, pull, cherry-pick/revert). They all used to provide rough, and
inconsistant error messages.
A new variable advice.resolveconflict is introduced, and allows more
verbose messages, pointing the user to the appropriate solution.
For commit, the error message used to look like this:
$ git commit
foo.txt: needs merge
foo.txt: unmerged (c34a92682e0394bc0d6f4d4a67a8e2d32395c169)
foo.txt: unmerged (3afcd75de8de0bb5076942fcb17446be50451030)
foo.txt: unmerged (c9785d77b76dfe4fb038bf927ee518f6ae45ede4)
error: Error building trees
The "need merge" line is given by refresh_cache. We add the IN_PORCELAIN
option to make the output more consistant with the other porcelain
commands, and catch the error in return, to stop with a clean error
message. The next lines were displayed by a call to cache_tree_update(),
which is not reached anymore if we noticed the conflict.
The new output looks like:
U foo.txt
fatal: 'commit' is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>' as
appropriate to mark resolution and make a commit, or use 'git commit -a'.
Pull is slightly modified to abort immediately if $GIT_DIR/MERGE_HEAD
exists instead of waiting for merge to complain.
The behavior of merge and the test-case are slightly modified to reflect
the usual flow: start with conflicts, fix them, and afterwards get rid of
MERGE_HEAD, with different error messages at each stage.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-12 12:54:44 +03:00
|
|
|
|
2009-09-09 15:38:58 +04:00
|
|
|
#endif /* ADVICE_H */
|