Merge branch 'ab/retire-advice-config'
Code clean up to migrate callers from older advice_config[] based API to newer advice_if_enabled() and advice_enabled() API. * ab/retire-advice-config: advice: move advice.graftFileDeprecated squashing to commit.[ch] advice: remove use of global advice_add_embedded_repo advice: remove read uses of most global `advice_` variables advice: add enum variants for missing advice variables
This commit is contained in:
commit
fd0d7036e0
85
advice.c
85
advice.c
@ -4,38 +4,6 @@
|
|||||||
#include "help.h"
|
#include "help.h"
|
||||||
#include "string-list.h"
|
#include "string-list.h"
|
||||||
|
|
||||||
int advice_fetch_show_forced_updates = 1;
|
|
||||||
int advice_push_update_rejected = 1;
|
|
||||||
int advice_push_non_ff_current = 1;
|
|
||||||
int advice_push_non_ff_matching = 1;
|
|
||||||
int advice_push_already_exists = 1;
|
|
||||||
int advice_push_fetch_first = 1;
|
|
||||||
int advice_push_needs_force = 1;
|
|
||||||
int advice_push_unqualified_ref_name = 1;
|
|
||||||
int advice_push_ref_needs_update = 1;
|
|
||||||
int advice_status_hints = 1;
|
|
||||||
int advice_status_u_option = 1;
|
|
||||||
int advice_status_ahead_behind_warning = 1;
|
|
||||||
int advice_commit_before_merge = 1;
|
|
||||||
int advice_reset_quiet_warning = 1;
|
|
||||||
int advice_resolve_conflict = 1;
|
|
||||||
int advice_sequencer_in_use = 1;
|
|
||||||
int advice_implicit_identity = 1;
|
|
||||||
int advice_detached_head = 1;
|
|
||||||
int advice_set_upstream_failure = 1;
|
|
||||||
int advice_object_name_warning = 1;
|
|
||||||
int advice_amworkdir = 1;
|
|
||||||
int advice_rm_hints = 1;
|
|
||||||
int advice_add_embedded_repo = 1;
|
|
||||||
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_submodule_alternate_error_strategy_die = 1;
|
|
||||||
int advice_add_ignored_file = 1;
|
|
||||||
int advice_add_empty_pathspec = 1;
|
|
||||||
int advice_skipped_cherry_picks = 1;
|
|
||||||
|
|
||||||
static int advice_use_color = -1;
|
static int advice_use_color = -1;
|
||||||
static char advice_colors[][COLOR_MAXLEN] = {
|
static char advice_colors[][COLOR_MAXLEN] = {
|
||||||
GIT_COLOR_RESET,
|
GIT_COLOR_RESET,
|
||||||
@ -63,51 +31,13 @@ static const char *advise_get_color(enum color_advice ix)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct {
|
|
||||||
const char *name;
|
|
||||||
int *preference;
|
|
||||||
} advice_config[] = {
|
|
||||||
{ "fetchShowForcedUpdates", &advice_fetch_show_forced_updates },
|
|
||||||
{ "pushUpdateRejected", &advice_push_update_rejected },
|
|
||||||
{ "pushNonFFCurrent", &advice_push_non_ff_current },
|
|
||||||
{ "pushNonFFMatching", &advice_push_non_ff_matching },
|
|
||||||
{ "pushAlreadyExists", &advice_push_already_exists },
|
|
||||||
{ "pushFetchFirst", &advice_push_fetch_first },
|
|
||||||
{ "pushNeedsForce", &advice_push_needs_force },
|
|
||||||
{ "pushUnqualifiedRefName", &advice_push_unqualified_ref_name },
|
|
||||||
{ "pushRefNeedsUpdate", &advice_push_ref_needs_update },
|
|
||||||
{ "statusHints", &advice_status_hints },
|
|
||||||
{ "statusUoption", &advice_status_u_option },
|
|
||||||
{ "statusAheadBehindWarning", &advice_status_ahead_behind_warning },
|
|
||||||
{ "commitBeforeMerge", &advice_commit_before_merge },
|
|
||||||
{ "resetQuiet", &advice_reset_quiet_warning },
|
|
||||||
{ "resolveConflict", &advice_resolve_conflict },
|
|
||||||
{ "sequencerInUse", &advice_sequencer_in_use },
|
|
||||||
{ "implicitIdentity", &advice_implicit_identity },
|
|
||||||
{ "detachedHead", &advice_detached_head },
|
|
||||||
{ "setUpstreamFailure", &advice_set_upstream_failure },
|
|
||||||
{ "objectNameWarning", &advice_object_name_warning },
|
|
||||||
{ "amWorkDir", &advice_amworkdir },
|
|
||||||
{ "rmHints", &advice_rm_hints },
|
|
||||||
{ "addEmbeddedRepo", &advice_add_embedded_repo },
|
|
||||||
{ "ignoredHook", &advice_ignored_hook },
|
|
||||||
{ "waitingForEditor", &advice_waiting_for_editor },
|
|
||||||
{ "graftFileDeprecated", &advice_graft_file_deprecated },
|
|
||||||
{ "checkoutAmbiguousRemoteBranchName", &advice_checkout_ambiguous_remote_branch_name },
|
|
||||||
{ "submoduleAlternateErrorStrategyDie", &advice_submodule_alternate_error_strategy_die },
|
|
||||||
{ "addIgnoredFile", &advice_add_ignored_file },
|
|
||||||
{ "addEmptyPathspec", &advice_add_empty_pathspec },
|
|
||||||
{ "skippedCherryPicks", &advice_skipped_cherry_picks },
|
|
||||||
|
|
||||||
/* make this an alias for backward compatibility */
|
|
||||||
{ "pushNonFastForward", &advice_push_update_rejected }
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
const char *key;
|
const char *key;
|
||||||
int enabled;
|
int enabled;
|
||||||
} advice_setting[] = {
|
} advice_setting[] = {
|
||||||
[ADVICE_ADD_EMBEDDED_REPO] = { "addEmbeddedRepo", 1 },
|
[ADVICE_ADD_EMBEDDED_REPO] = { "addEmbeddedRepo", 1 },
|
||||||
|
[ADVICE_ADD_EMPTY_PATHSPEC] = { "addEmptyPathspec", 1 },
|
||||||
|
[ADVICE_ADD_IGNORED_FILE] = { "addIgnoredFile", 1 },
|
||||||
[ADVICE_AM_WORK_DIR] = { "amWorkDir", 1 },
|
[ADVICE_AM_WORK_DIR] = { "amWorkDir", 1 },
|
||||||
[ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME] = { "checkoutAmbiguousRemoteBranchName", 1 },
|
[ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME] = { "checkoutAmbiguousRemoteBranchName", 1 },
|
||||||
[ADVICE_COMMIT_BEFORE_MERGE] = { "commitBeforeMerge", 1 },
|
[ADVICE_COMMIT_BEFORE_MERGE] = { "commitBeforeMerge", 1 },
|
||||||
@ -224,13 +154,6 @@ int git_default_advice_config(const char *var, const char *value)
|
|||||||
if (!skip_prefix(var, "advice.", &k))
|
if (!skip_prefix(var, "advice.", &k))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(advice_config); i++) {
|
|
||||||
if (strcasecmp(k, advice_config[i].name))
|
|
||||||
continue;
|
|
||||||
*advice_config[i].preference = git_config_bool(var, value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(advice_setting); i++) {
|
for (i = 0; i < ARRAY_SIZE(advice_setting); i++) {
|
||||||
if (strcasecmp(k, advice_setting[i].key))
|
if (strcasecmp(k, advice_setting[i].key))
|
||||||
continue;
|
continue;
|
||||||
@ -265,7 +188,7 @@ int error_resolve_conflict(const char *me)
|
|||||||
error(_("It is not possible to %s because you have unmerged files."),
|
error(_("It is not possible to %s because you have unmerged files."),
|
||||||
me);
|
me);
|
||||||
|
|
||||||
if (advice_resolve_conflict)
|
if (advice_enabled(ADVICE_RESOLVE_CONFLICT))
|
||||||
/*
|
/*
|
||||||
* Message used both when 'git commit' fails and when
|
* Message used both when 'git commit' fails and when
|
||||||
* other commands doing a merge do.
|
* other commands doing a merge do.
|
||||||
@ -284,7 +207,7 @@ void NORETURN die_resolve_conflict(const char *me)
|
|||||||
void NORETURN die_conclude_merge(void)
|
void NORETURN die_conclude_merge(void)
|
||||||
{
|
{
|
||||||
error(_("You have not concluded your merge (MERGE_HEAD exists)."));
|
error(_("You have not concluded your merge (MERGE_HEAD exists)."));
|
||||||
if (advice_resolve_conflict)
|
if (advice_enabled(ADVICE_RESOLVE_CONFLICT))
|
||||||
advise(_("Please, commit your changes before merging."));
|
advise(_("Please, commit your changes before merging."));
|
||||||
die(_("Exiting because of unfinished merge."));
|
die(_("Exiting because of unfinished merge."));
|
||||||
}
|
}
|
||||||
|
34
advice.h
34
advice.h
@ -5,38 +5,6 @@
|
|||||||
|
|
||||||
struct string_list;
|
struct string_list;
|
||||||
|
|
||||||
extern int advice_fetch_show_forced_updates;
|
|
||||||
extern int advice_push_update_rejected;
|
|
||||||
extern int advice_push_non_ff_current;
|
|
||||||
extern int advice_push_non_ff_matching;
|
|
||||||
extern int advice_push_already_exists;
|
|
||||||
extern int advice_push_fetch_first;
|
|
||||||
extern int advice_push_needs_force;
|
|
||||||
extern int advice_push_unqualified_ref_name;
|
|
||||||
extern int advice_push_ref_needs_update;
|
|
||||||
extern int advice_status_hints;
|
|
||||||
extern int advice_status_u_option;
|
|
||||||
extern int advice_status_ahead_behind_warning;
|
|
||||||
extern int advice_commit_before_merge;
|
|
||||||
extern int advice_reset_quiet_warning;
|
|
||||||
extern int advice_resolve_conflict;
|
|
||||||
extern int advice_sequencer_in_use;
|
|
||||||
extern int advice_implicit_identity;
|
|
||||||
extern int advice_detached_head;
|
|
||||||
extern int advice_set_upstream_failure;
|
|
||||||
extern int advice_object_name_warning;
|
|
||||||
extern int advice_amworkdir;
|
|
||||||
extern int advice_rm_hints;
|
|
||||||
extern int advice_add_embedded_repo;
|
|
||||||
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_submodule_alternate_error_strategy_die;
|
|
||||||
extern int advice_add_ignored_file;
|
|
||||||
extern int advice_add_empty_pathspec;
|
|
||||||
extern int advice_skipped_cherry_picks;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To add a new advice, you need to:
|
* To add a new advice, you need to:
|
||||||
* Define a new advice_type.
|
* Define a new advice_type.
|
||||||
@ -46,6 +14,8 @@ extern int advice_skipped_cherry_picks;
|
|||||||
*/
|
*/
|
||||||
enum advice_type {
|
enum advice_type {
|
||||||
ADVICE_ADD_EMBEDDED_REPO,
|
ADVICE_ADD_EMBEDDED_REPO,
|
||||||
|
ADVICE_ADD_EMPTY_PATHSPEC,
|
||||||
|
ADVICE_ADD_IGNORED_FILE,
|
||||||
ADVICE_AM_WORK_DIR,
|
ADVICE_AM_WORK_DIR,
|
||||||
ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
|
ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
|
||||||
ADVICE_COMMIT_BEFORE_MERGE,
|
ADVICE_COMMIT_BEFORE_MERGE,
|
||||||
|
2
branch.c
2
branch.c
@ -271,7 +271,7 @@ void create_branch(struct repository *r,
|
|||||||
real_ref = NULL;
|
real_ref = NULL;
|
||||||
if (get_oid_mb(start_name, &oid)) {
|
if (get_oid_mb(start_name, &oid)) {
|
||||||
if (explicit_tracking) {
|
if (explicit_tracking) {
|
||||||
if (advice_set_upstream_failure) {
|
if (advice_enabled(ADVICE_SET_UPSTREAM_FAILURE)) {
|
||||||
error(_(upstream_missing), start_name);
|
error(_(upstream_missing), start_name);
|
||||||
advise(_(upstream_advice));
|
advise(_(upstream_advice));
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -423,6 +423,7 @@ static const char embedded_advice[] = N_(
|
|||||||
static void check_embedded_repo(const char *path)
|
static void check_embedded_repo(const char *path)
|
||||||
{
|
{
|
||||||
struct strbuf name = STRBUF_INIT;
|
struct strbuf name = STRBUF_INIT;
|
||||||
|
static int adviced_on_embedded_repo = 0;
|
||||||
|
|
||||||
if (!warn_on_embedded_repo)
|
if (!warn_on_embedded_repo)
|
||||||
return;
|
return;
|
||||||
@ -434,10 +435,10 @@ static void check_embedded_repo(const char *path)
|
|||||||
strbuf_strip_suffix(&name, "/");
|
strbuf_strip_suffix(&name, "/");
|
||||||
|
|
||||||
warning(_("adding embedded git repository: %s"), name.buf);
|
warning(_("adding embedded git repository: %s"), name.buf);
|
||||||
if (advice_add_embedded_repo) {
|
if (!adviced_on_embedded_repo &&
|
||||||
|
advice_enabled(ADVICE_ADD_EMBEDDED_REPO)) {
|
||||||
advise(embedded_advice, name.buf, name.buf);
|
advise(embedded_advice, name.buf, name.buf);
|
||||||
/* there may be multiple entries; advise only once */
|
adviced_on_embedded_repo = 1;
|
||||||
advice_add_embedded_repo = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_release(&name);
|
strbuf_release(&name);
|
||||||
@ -451,7 +452,7 @@ static int add_files(struct dir_struct *dir, int flags)
|
|||||||
fprintf(stderr, _(ignore_error));
|
fprintf(stderr, _(ignore_error));
|
||||||
for (i = 0; i < dir->ignored_nr; i++)
|
for (i = 0; i < dir->ignored_nr; i++)
|
||||||
fprintf(stderr, "%s\n", dir->ignored[i]->name);
|
fprintf(stderr, "%s\n", dir->ignored[i]->name);
|
||||||
if (advice_add_ignored_file)
|
if (advice_enabled(ADVICE_ADD_IGNORED_FILE))
|
||||||
advise(_("Use -f if you really want to add them.\n"
|
advise(_("Use -f if you really want to add them.\n"
|
||||||
"Turn this message off by running\n"
|
"Turn this message off by running\n"
|
||||||
"\"git config advice.addIgnoredFile false\""));
|
"\"git config advice.addIgnoredFile false\""));
|
||||||
@ -560,7 +561,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
if (require_pathspec && pathspec.nr == 0) {
|
if (require_pathspec && pathspec.nr == 0) {
|
||||||
fprintf(stderr, _("Nothing specified, nothing added.\n"));
|
fprintf(stderr, _("Nothing specified, nothing added.\n"));
|
||||||
if (advice_add_empty_pathspec)
|
if (advice_enabled(ADVICE_ADD_EMPTY_PATHSPEC))
|
||||||
advise( _("Maybe you wanted to say 'git add .'?\n"
|
advise( _("Maybe you wanted to say 'git add .'?\n"
|
||||||
"Turn this message off by running\n"
|
"Turn this message off by running\n"
|
||||||
"\"git config advice.addEmptyPathspec false\""));
|
"\"git config advice.addEmptyPathspec false\""));
|
||||||
|
@ -1820,7 +1820,7 @@ static void am_run(struct am_state *state, int resume)
|
|||||||
printf_ln(_("Patch failed at %s %.*s"), msgnum(state),
|
printf_ln(_("Patch failed at %s %.*s"), msgnum(state),
|
||||||
linelen(state->msg), state->msg);
|
linelen(state->msg), state->msg);
|
||||||
|
|
||||||
if (advice_amworkdir)
|
if (advice_enabled(ADVICE_AM_WORK_DIR))
|
||||||
advise(_("Use 'git am --show-current-patch=diff' to see the failed patch"));
|
advise(_("Use 'git am --show-current-patch=diff' to see the failed patch"));
|
||||||
|
|
||||||
die_user_resolve(state);
|
die_user_resolve(state);
|
||||||
|
@ -918,7 +918,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
|
|||||||
REF_NO_DEREF, UPDATE_REFS_DIE_ON_ERR);
|
REF_NO_DEREF, UPDATE_REFS_DIE_ON_ERR);
|
||||||
if (!opts->quiet) {
|
if (!opts->quiet) {
|
||||||
if (old_branch_info->path &&
|
if (old_branch_info->path &&
|
||||||
advice_detached_head && !opts->force_detach)
|
advice_enabled(ADVICE_DETACHED_HEAD) && !opts->force_detach)
|
||||||
detach_advice(new_branch_info->name);
|
detach_advice(new_branch_info->name);
|
||||||
describe_detached_head(_("HEAD is now at"), new_branch_info->commit);
|
describe_detached_head(_("HEAD is now at"), new_branch_info->commit);
|
||||||
}
|
}
|
||||||
@ -1011,7 +1011,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
|
|||||||
sb.buf);
|
sb.buf);
|
||||||
strbuf_release(&sb);
|
strbuf_release(&sb);
|
||||||
|
|
||||||
if (advice_detached_head)
|
if (advice_enabled(ADVICE_DETACHED_HEAD))
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
Q_(
|
Q_(
|
||||||
/* The singular version */
|
/* The singular version */
|
||||||
@ -1182,7 +1182,7 @@ static const char *parse_remote_branch(const char *arg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!remote && num_matches > 1) {
|
if (!remote && num_matches > 1) {
|
||||||
if (advice_checkout_ambiguous_remote_branch_name) {
|
if (advice_enabled(ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME)) {
|
||||||
advise(_("If you meant to check out a remote tracking branch on, e.g. 'origin',\n"
|
advise(_("If you meant to check out a remote tracking branch on, e.g. 'origin',\n"
|
||||||
"you can do so by fully qualifying the name with the --track option:\n"
|
"you can do so by fully qualifying the name with the --track option:\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -786,7 +786,7 @@ static int checkout(int submodule_progress)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!strcmp(head, "HEAD")) {
|
if (!strcmp(head, "HEAD")) {
|
||||||
if (advice_detached_head)
|
if (advice_enabled(ADVICE_DETACHED_HEAD))
|
||||||
detach_advice(oid_to_hex(&oid));
|
detach_advice(oid_to_hex(&oid));
|
||||||
FREE_AND_NULL(head);
|
FREE_AND_NULL(head);
|
||||||
} else {
|
} else {
|
||||||
|
@ -203,7 +203,7 @@ static void status_init_config(struct wt_status *s, config_fn_t fn)
|
|||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
git_config(fn, s);
|
git_config(fn, s);
|
||||||
determine_whence(s);
|
determine_whence(s);
|
||||||
s->hints = advice_status_hints; /* must come after git_config() */
|
s->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after git_config() */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rollback_index_files(void)
|
static void rollback_index_files(void)
|
||||||
@ -1033,7 +1033,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
|||||||
*/
|
*/
|
||||||
if (!committable && whence != FROM_MERGE && !allow_empty &&
|
if (!committable && whence != FROM_MERGE && !allow_empty &&
|
||||||
!(amend && is_a_merge(current_head))) {
|
!(amend && is_a_merge(current_head))) {
|
||||||
s->hints = advice_status_hints;
|
s->hints = advice_enabled(ADVICE_STATUS_HINTS);
|
||||||
s->display_comment_prefix = old_display_comment_prefix;
|
s->display_comment_prefix = old_display_comment_prefix;
|
||||||
run_status(stdout, index_file, prefix, 0, s);
|
run_status(stdout, index_file, prefix, 0, s);
|
||||||
if (amend)
|
if (amend)
|
||||||
|
@ -1236,7 +1236,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
|
|||||||
" 'git remote prune %s' to remove any old, conflicting "
|
" 'git remote prune %s' to remove any old, conflicting "
|
||||||
"branches"), remote_name);
|
"branches"), remote_name);
|
||||||
|
|
||||||
if (advice_fetch_show_forced_updates) {
|
if (advice_enabled(ADVICE_FETCH_SHOW_FORCED_UPDATES)) {
|
||||||
if (!fetch_show_forced_updates) {
|
if (!fetch_show_forced_updates) {
|
||||||
warning(_(warn_show_forced_updates));
|
warning(_(warn_show_forced_updates));
|
||||||
} else if (forced_updates_ms > FORCED_UPDATES_DELAY_WARNING_IN_MS) {
|
} else if (forced_updates_ms > FORCED_UPDATES_DELAY_WARNING_IN_MS) {
|
||||||
|
@ -1368,14 +1368,14 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
* There is no unmerged entry, don't advise 'git
|
* There is no unmerged entry, don't advise 'git
|
||||||
* add/rm <file>', just 'git commit'.
|
* add/rm <file>', just 'git commit'.
|
||||||
*/
|
*/
|
||||||
if (advice_resolve_conflict)
|
if (advice_enabled(ADVICE_RESOLVE_CONFLICT))
|
||||||
die(_("You have not concluded your merge (MERGE_HEAD exists).\n"
|
die(_("You have not concluded your merge (MERGE_HEAD exists).\n"
|
||||||
"Please, commit your changes before you merge."));
|
"Please, commit your changes before you merge."));
|
||||||
else
|
else
|
||||||
die(_("You have not concluded your merge (MERGE_HEAD exists)."));
|
die(_("You have not concluded your merge (MERGE_HEAD exists)."));
|
||||||
}
|
}
|
||||||
if (ref_exists("CHERRY_PICK_HEAD")) {
|
if (ref_exists("CHERRY_PICK_HEAD")) {
|
||||||
if (advice_resolve_conflict)
|
if (advice_enabled(ADVICE_RESOLVE_CONFLICT))
|
||||||
die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
|
die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
|
||||||
"Please, commit your changes before you merge."));
|
"Please, commit your changes before you merge."));
|
||||||
else
|
else
|
||||||
|
@ -289,42 +289,42 @@ static const char message_advice_ref_needs_update[] =
|
|||||||
|
|
||||||
static void advise_pull_before_push(void)
|
static void advise_pull_before_push(void)
|
||||||
{
|
{
|
||||||
if (!advice_push_non_ff_current || !advice_push_update_rejected)
|
if (!advice_enabled(ADVICE_PUSH_NON_FF_CURRENT) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED))
|
||||||
return;
|
return;
|
||||||
advise(_(message_advice_pull_before_push));
|
advise(_(message_advice_pull_before_push));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void advise_checkout_pull_push(void)
|
static void advise_checkout_pull_push(void)
|
||||||
{
|
{
|
||||||
if (!advice_push_non_ff_matching || !advice_push_update_rejected)
|
if (!advice_enabled(ADVICE_PUSH_NON_FF_MATCHING) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED))
|
||||||
return;
|
return;
|
||||||
advise(_(message_advice_checkout_pull_push));
|
advise(_(message_advice_checkout_pull_push));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void advise_ref_already_exists(void)
|
static void advise_ref_already_exists(void)
|
||||||
{
|
{
|
||||||
if (!advice_push_already_exists || !advice_push_update_rejected)
|
if (!advice_enabled(ADVICE_PUSH_ALREADY_EXISTS) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED))
|
||||||
return;
|
return;
|
||||||
advise(_(message_advice_ref_already_exists));
|
advise(_(message_advice_ref_already_exists));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void advise_ref_fetch_first(void)
|
static void advise_ref_fetch_first(void)
|
||||||
{
|
{
|
||||||
if (!advice_push_fetch_first || !advice_push_update_rejected)
|
if (!advice_enabled(ADVICE_PUSH_FETCH_FIRST) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED))
|
||||||
return;
|
return;
|
||||||
advise(_(message_advice_ref_fetch_first));
|
advise(_(message_advice_ref_fetch_first));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void advise_ref_needs_force(void)
|
static void advise_ref_needs_force(void)
|
||||||
{
|
{
|
||||||
if (!advice_push_needs_force || !advice_push_update_rejected)
|
if (!advice_enabled(ADVICE_PUSH_NEEDS_FORCE) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED))
|
||||||
return;
|
return;
|
||||||
advise(_(message_advice_ref_needs_force));
|
advise(_(message_advice_ref_needs_force));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void advise_ref_needs_update(void)
|
static void advise_ref_needs_update(void)
|
||||||
{
|
{
|
||||||
if (!advice_push_ref_needs_update || !advice_push_update_rejected)
|
if (!advice_enabled(ADVICE_PUSH_REF_NEEDS_UPDATE) || !advice_enabled(ADVICE_PUSH_UPDATE_REJECTED))
|
||||||
return;
|
return;
|
||||||
advise(_(message_advice_ref_needs_update));
|
advise(_(message_advice_ref_needs_update));
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ static int convert_graft_file(int force)
|
|||||||
if (!fp)
|
if (!fp)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
advice_graft_file_deprecated = 0;
|
no_graft_file_deprecated_advice = 1;
|
||||||
while (strbuf_getline(&buf, fp) != EOF) {
|
while (strbuf_getline(&buf, fp) != EOF) {
|
||||||
if (*buf.buf == '#')
|
if (*buf.buf == '#')
|
||||||
continue;
|
continue;
|
||||||
|
@ -412,7 +412,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
|
|||||||
refresh_index(&the_index, flags, NULL, NULL,
|
refresh_index(&the_index, flags, NULL, NULL,
|
||||||
_("Unstaged changes after reset:"));
|
_("Unstaged changes after reset:"));
|
||||||
t_delta_in_ms = (getnanotime() - t_begin) / 1000000;
|
t_delta_in_ms = (getnanotime() - t_begin) / 1000000;
|
||||||
if (advice_reset_quiet_warning && t_delta_in_ms > REFRESH_INDEX_DELAY_WARNING_IN_MS) {
|
if (advice_enabled(ADVICE_RESET_QUIET_WARNING) && t_delta_in_ms > REFRESH_INDEX_DELAY_WARNING_IN_MS) {
|
||||||
printf(_("\nIt took %.2f seconds to enumerate unstaged changes after reset. You can\n"
|
printf(_("\nIt took %.2f seconds to enumerate unstaged changes after reset. You can\n"
|
||||||
"use '--quiet' to avoid this. Set the config setting reset.quiet to true\n"
|
"use '--quiet' to avoid this. Set the config setting reset.quiet to true\n"
|
||||||
"to make this the default.\n"), t_delta_in_ms / 1000.0);
|
"to make this the default.\n"), t_delta_in_ms / 1000.0);
|
||||||
|
@ -55,7 +55,7 @@ static void print_error_files(struct string_list *files_list,
|
|||||||
strbuf_addf(&err_msg,
|
strbuf_addf(&err_msg,
|
||||||
"\n %s",
|
"\n %s",
|
||||||
files_list->items[i].string);
|
files_list->items[i].string);
|
||||||
if (advice_rm_hints)
|
if (advice_enabled(ADVICE_RM_HINTS))
|
||||||
strbuf_addstr(&err_msg, hints_msg);
|
strbuf_addstr(&err_msg, hints_msg);
|
||||||
*errs = error("%s", err_msg.buf);
|
*errs = error("%s", err_msg.buf);
|
||||||
strbuf_release(&err_msg);
|
strbuf_release(&err_msg);
|
||||||
|
@ -1724,7 +1724,7 @@ static int add_possible_reference_from_superproject(
|
|||||||
} else {
|
} else {
|
||||||
switch (sas->error_mode) {
|
switch (sas->error_mode) {
|
||||||
case SUBMODULE_ALTERNATE_ERROR_DIE:
|
case SUBMODULE_ALTERNATE_ERROR_DIE:
|
||||||
if (advice_submodule_alternate_error_strategy_die)
|
if (advice_enabled(ADVICE_SUBMODULE_ALTERNATE_ERROR_STRATEGY_DIE))
|
||||||
advise(_(alternate_error_advice));
|
advise(_(alternate_error_advice));
|
||||||
die(_("submodule '%s' cannot add alternate: %s"),
|
die(_("submodule '%s' cannot add alternate: %s"),
|
||||||
sas->submodule_name, err.buf);
|
sas->submodule_name, err.buf);
|
||||||
|
4
commit.c
4
commit.c
@ -25,6 +25,7 @@
|
|||||||
static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
|
static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
|
||||||
|
|
||||||
int save_commit_buffer = 1;
|
int save_commit_buffer = 1;
|
||||||
|
int no_graft_file_deprecated_advice;
|
||||||
|
|
||||||
const char *commit_type = "commit";
|
const char *commit_type = "commit";
|
||||||
|
|
||||||
@ -190,7 +191,8 @@ static int read_graft_file(struct repository *r, const char *graft_file)
|
|||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return -1;
|
return -1;
|
||||||
if (advice_graft_file_deprecated)
|
if (!no_graft_file_deprecated_advice &&
|
||||||
|
advice_enabled(ADVICE_GRAFT_FILE_DEPRECATED))
|
||||||
advise(_("Support for <GIT_DIR>/info/grafts is deprecated\n"
|
advise(_("Support for <GIT_DIR>/info/grafts is deprecated\n"
|
||||||
"and will be removed in a future Git version.\n"
|
"and will be removed in a future Git version.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
1
commit.h
1
commit.h
@ -41,6 +41,7 @@ struct commit {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern int save_commit_buffer;
|
extern int save_commit_buffer;
|
||||||
|
extern int no_graft_file_deprecated_advice;
|
||||||
extern const char *commit_type;
|
extern const char *commit_type;
|
||||||
|
|
||||||
/* While we can decorate any object with a name, it's only used for commits.. */
|
/* While we can decorate any object with a name, it's only used for commits.. */
|
||||||
|
2
editor.c
2
editor.c
@ -58,7 +58,7 @@ static int launch_specified_editor(const char *editor, const char *path,
|
|||||||
const char *args[] = { editor, NULL, NULL };
|
const char *args[] = { editor, NULL, NULL };
|
||||||
struct child_process p = CHILD_PROCESS_INIT;
|
struct child_process p = CHILD_PROCESS_INIT;
|
||||||
int ret, sig;
|
int ret, sig;
|
||||||
int print_waiting_for_editor = advice_waiting_for_editor && isatty(2);
|
int print_waiting_for_editor = advice_enabled(ADVICE_WAITING_FOR_EDITOR) && isatty(2);
|
||||||
|
|
||||||
if (print_waiting_for_editor) {
|
if (print_waiting_for_editor) {
|
||||||
/*
|
/*
|
||||||
|
@ -273,7 +273,7 @@ static void check_notes_merge_worktree(struct notes_merge_options *o)
|
|||||||
*/
|
*/
|
||||||
if (file_exists(git_path(NOTES_MERGE_WORKTREE)) &&
|
if (file_exists(git_path(NOTES_MERGE_WORKTREE)) &&
|
||||||
!is_empty_dir(git_path(NOTES_MERGE_WORKTREE))) {
|
!is_empty_dir(git_path(NOTES_MERGE_WORKTREE))) {
|
||||||
if (advice_resolve_conflict)
|
if (advice_enabled(ADVICE_RESOLVE_CONFLICT))
|
||||||
die(_("You have not concluded your previous "
|
die(_("You have not concluded your previous "
|
||||||
"notes merge (%s exists).\nPlease, use "
|
"notes merge (%s exists).\nPlease, use "
|
||||||
"'git notes merge --commit' or 'git notes "
|
"'git notes merge --commit' or 'git notes "
|
||||||
|
@ -806,7 +806,7 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
|
|||||||
refs_found = repo_dwim_ref(r, str, len, &tmp_oid, &real_ref, 0);
|
refs_found = repo_dwim_ref(r, str, len, &tmp_oid, &real_ref, 0);
|
||||||
if (refs_found > 0) {
|
if (refs_found > 0) {
|
||||||
warning(warn_msg, len, str);
|
warning(warn_msg, len, str);
|
||||||
if (advice_object_name_warning)
|
if (advice_enabled(ADVICE_OBJECT_NAME_WARNING))
|
||||||
fprintf(stderr, "%s\n", _(object_name_msg));
|
fprintf(stderr, "%s\n", _(object_name_msg));
|
||||||
}
|
}
|
||||||
free(real_ref);
|
free(real_ref);
|
||||||
|
12
remote.c
12
remote.c
@ -1111,7 +1111,7 @@ static void show_push_unqualified_ref_name_error(const char *dst_value,
|
|||||||
"Neither worked, so we gave up. You must fully qualify the ref."),
|
"Neither worked, so we gave up. You must fully qualify the ref."),
|
||||||
dst_value, matched_src_name);
|
dst_value, matched_src_name);
|
||||||
|
|
||||||
if (!advice_push_unqualified_ref_name)
|
if (!advice_enabled(ADVICE_PUSH_UNQUALIFIED_REF_NAME))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (get_oid(matched_src_name, &oid))
|
if (get_oid(matched_src_name, &oid))
|
||||||
@ -2118,7 +2118,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,
|
|||||||
strbuf_addf(sb,
|
strbuf_addf(sb,
|
||||||
_("Your branch is based on '%s', but the upstream is gone.\n"),
|
_("Your branch is based on '%s', but the upstream is gone.\n"),
|
||||||
base);
|
base);
|
||||||
if (advice_status_hints)
|
if (advice_enabled(ADVICE_STATUS_HINTS))
|
||||||
strbuf_addstr(sb,
|
strbuf_addstr(sb,
|
||||||
_(" (use \"git branch --unset-upstream\" to fixup)\n"));
|
_(" (use \"git branch --unset-upstream\" to fixup)\n"));
|
||||||
} else if (!sti) {
|
} else if (!sti) {
|
||||||
@ -2129,7 +2129,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,
|
|||||||
strbuf_addf(sb,
|
strbuf_addf(sb,
|
||||||
_("Your branch and '%s' refer to different commits.\n"),
|
_("Your branch and '%s' refer to different commits.\n"),
|
||||||
base);
|
base);
|
||||||
if (advice_status_hints)
|
if (advice_enabled(ADVICE_STATUS_HINTS))
|
||||||
strbuf_addf(sb, _(" (use \"%s\" for details)\n"),
|
strbuf_addf(sb, _(" (use \"%s\" for details)\n"),
|
||||||
"git status --ahead-behind");
|
"git status --ahead-behind");
|
||||||
} else if (!theirs) {
|
} else if (!theirs) {
|
||||||
@ -2138,7 +2138,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,
|
|||||||
"Your branch is ahead of '%s' by %d commits.\n",
|
"Your branch is ahead of '%s' by %d commits.\n",
|
||||||
ours),
|
ours),
|
||||||
base, ours);
|
base, ours);
|
||||||
if (advice_status_hints)
|
if (advice_enabled(ADVICE_STATUS_HINTS))
|
||||||
strbuf_addstr(sb,
|
strbuf_addstr(sb,
|
||||||
_(" (use \"git push\" to publish your local commits)\n"));
|
_(" (use \"git push\" to publish your local commits)\n"));
|
||||||
} else if (!ours) {
|
} else if (!ours) {
|
||||||
@ -2149,7 +2149,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,
|
|||||||
"and can be fast-forwarded.\n",
|
"and can be fast-forwarded.\n",
|
||||||
theirs),
|
theirs),
|
||||||
base, theirs);
|
base, theirs);
|
||||||
if (advice_status_hints)
|
if (advice_enabled(ADVICE_STATUS_HINTS))
|
||||||
strbuf_addstr(sb,
|
strbuf_addstr(sb,
|
||||||
_(" (use \"git pull\" to update your local branch)\n"));
|
_(" (use \"git pull\" to update your local branch)\n"));
|
||||||
} else {
|
} else {
|
||||||
@ -2162,7 +2162,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,
|
|||||||
"respectively.\n",
|
"respectively.\n",
|
||||||
ours + theirs),
|
ours + theirs),
|
||||||
base, ours, theirs);
|
base, ours, theirs);
|
||||||
if (advice_status_hints)
|
if (advice_enabled(ADVICE_STATUS_HINTS))
|
||||||
strbuf_addstr(sb,
|
strbuf_addstr(sb,
|
||||||
_(" (use \"git pull\" to merge the remote branch into yours)\n"));
|
_(" (use \"git pull\" to merge the remote branch into yours)\n"));
|
||||||
}
|
}
|
||||||
|
@ -1334,7 +1334,7 @@ const char *find_hook(const char *name)
|
|||||||
err = errno;
|
err = errno;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (err == EACCES && advice_ignored_hook) {
|
if (err == EACCES && advice_enabled(ADVICE_IGNORED_HOOK)) {
|
||||||
static struct string_list advise_given = STRING_LIST_INIT_DUP;
|
static struct string_list advise_given = STRING_LIST_INIT_DUP;
|
||||||
|
|
||||||
if (!string_list_lookup(&advise_given, name)) {
|
if (!string_list_lookup(&advise_given, name)) {
|
||||||
|
@ -498,7 +498,7 @@ static int error_dirty_index(struct repository *repo, struct replay_opts *opts)
|
|||||||
error(_("your local changes would be overwritten by %s."),
|
error(_("your local changes would be overwritten by %s."),
|
||||||
_(action_name(opts)));
|
_(action_name(opts)));
|
||||||
|
|
||||||
if (advice_commit_before_merge)
|
if (advice_enabled(ADVICE_COMMIT_BEFORE_MERGE))
|
||||||
advise(_("commit your changes or stash them to proceed."));
|
advise(_("commit your changes or stash them to proceed."));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1306,7 +1306,7 @@ void print_commit_summary(struct repository *r,
|
|||||||
if (!committer_ident_sufficiently_given()) {
|
if (!committer_ident_sufficiently_given()) {
|
||||||
strbuf_addstr(&format, "\n Committer: ");
|
strbuf_addstr(&format, "\n Committer: ");
|
||||||
strbuf_addbuf_percentquote(&format, &committer_ident);
|
strbuf_addbuf_percentquote(&format, &committer_ident);
|
||||||
if (advice_implicit_identity) {
|
if (advice_enabled(ADVICE_IMPLICIT_IDENTITY)) {
|
||||||
strbuf_addch(&format, '\n');
|
strbuf_addch(&format, '\n');
|
||||||
strbuf_addstr(&format, implicit_ident_advice());
|
strbuf_addstr(&format, implicit_ident_advice());
|
||||||
}
|
}
|
||||||
@ -3054,7 +3054,7 @@ static int create_seq_dir(struct repository *r)
|
|||||||
}
|
}
|
||||||
if (in_progress_error) {
|
if (in_progress_error) {
|
||||||
error("%s", in_progress_error);
|
error("%s", in_progress_error);
|
||||||
if (advice_sequencer_in_use)
|
if (advice_enabled(ADVICE_SEQUENCER_IN_USE))
|
||||||
advise(in_progress_advice,
|
advise(in_progress_advice,
|
||||||
advise_skip ? "--skip | " : "");
|
advise_skip ? "--skip | " : "");
|
||||||
return -1;
|
return -1;
|
||||||
@ -3258,7 +3258,7 @@ int sequencer_skip(struct repository *r, struct replay_opts *opts)
|
|||||||
give_advice:
|
give_advice:
|
||||||
error(_("there is nothing to skip"));
|
error(_("there is nothing to skip"));
|
||||||
|
|
||||||
if (advice_resolve_conflict) {
|
if (advice_enabled(ADVICE_RESOLVE_CONFLICT)) {
|
||||||
advise(_("have you committed already?\n"
|
advise(_("have you committed already?\n"
|
||||||
"try \"git %s --continue\""),
|
"try \"git %s --continue\""),
|
||||||
action == REPLAY_REVERT ? "revert" : "cherry-pick");
|
action == REPLAY_REVERT ? "revert" : "cherry-pick");
|
||||||
|
@ -111,17 +111,17 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
|||||||
strvec_init(&opts->msgs_to_free);
|
strvec_init(&opts->msgs_to_free);
|
||||||
|
|
||||||
if (!strcmp(cmd, "checkout"))
|
if (!strcmp(cmd, "checkout"))
|
||||||
msg = advice_commit_before_merge
|
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||||
? _("Your local changes to the following files would be overwritten by checkout:\n%%s"
|
? _("Your local changes to the following files would be overwritten by checkout:\n%%s"
|
||||||
"Please commit your changes or stash them before you switch branches.")
|
"Please commit your changes or stash them before you switch branches.")
|
||||||
: _("Your local changes to the following files would be overwritten by checkout:\n%%s");
|
: _("Your local changes to the following files would be overwritten by checkout:\n%%s");
|
||||||
else if (!strcmp(cmd, "merge"))
|
else if (!strcmp(cmd, "merge"))
|
||||||
msg = advice_commit_before_merge
|
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||||
? _("Your local changes to the following files would be overwritten by merge:\n%%s"
|
? _("Your local changes to the following files would be overwritten by merge:\n%%s"
|
||||||
"Please commit your changes or stash them before you merge.")
|
"Please commit your changes or stash them before you merge.")
|
||||||
: _("Your local changes to the following files would be overwritten by merge:\n%%s");
|
: _("Your local changes to the following files would be overwritten by merge:\n%%s");
|
||||||
else
|
else
|
||||||
msg = advice_commit_before_merge
|
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||||
? _("Your local changes to the following files would be overwritten by %s:\n%%s"
|
? _("Your local changes to the following files would be overwritten by %s:\n%%s"
|
||||||
"Please commit your changes or stash them before you %s.")
|
"Please commit your changes or stash them before you %s.")
|
||||||
: _("Your local changes to the following files would be overwritten by %s:\n%%s");
|
: _("Your local changes to the following files would be overwritten by %s:\n%%s");
|
||||||
@ -132,17 +132,17 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
|||||||
_("Updating the following directories would lose untracked files in them:\n%s");
|
_("Updating the following directories would lose untracked files in them:\n%s");
|
||||||
|
|
||||||
if (!strcmp(cmd, "checkout"))
|
if (!strcmp(cmd, "checkout"))
|
||||||
msg = advice_commit_before_merge
|
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||||
? _("The following untracked working tree files would be removed by checkout:\n%%s"
|
? _("The following untracked working tree files would be removed by checkout:\n%%s"
|
||||||
"Please move or remove them before you switch branches.")
|
"Please move or remove them before you switch branches.")
|
||||||
: _("The following untracked working tree files would be removed by checkout:\n%%s");
|
: _("The following untracked working tree files would be removed by checkout:\n%%s");
|
||||||
else if (!strcmp(cmd, "merge"))
|
else if (!strcmp(cmd, "merge"))
|
||||||
msg = advice_commit_before_merge
|
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||||
? _("The following untracked working tree files would be removed by merge:\n%%s"
|
? _("The following untracked working tree files would be removed by merge:\n%%s"
|
||||||
"Please move or remove them before you merge.")
|
"Please move or remove them before you merge.")
|
||||||
: _("The following untracked working tree files would be removed by merge:\n%%s");
|
: _("The following untracked working tree files would be removed by merge:\n%%s");
|
||||||
else
|
else
|
||||||
msg = advice_commit_before_merge
|
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||||
? _("The following untracked working tree files would be removed by %s:\n%%s"
|
? _("The following untracked working tree files would be removed by %s:\n%%s"
|
||||||
"Please move or remove them before you %s.")
|
"Please move or remove them before you %s.")
|
||||||
: _("The following untracked working tree files would be removed by %s:\n%%s");
|
: _("The following untracked working tree files would be removed by %s:\n%%s");
|
||||||
@ -150,17 +150,17 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
|
|||||||
strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd);
|
strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd);
|
||||||
|
|
||||||
if (!strcmp(cmd, "checkout"))
|
if (!strcmp(cmd, "checkout"))
|
||||||
msg = advice_commit_before_merge
|
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||||
? _("The following untracked working tree files would be overwritten by checkout:\n%%s"
|
? _("The following untracked working tree files would be overwritten by checkout:\n%%s"
|
||||||
"Please move or remove them before you switch branches.")
|
"Please move or remove them before you switch branches.")
|
||||||
: _("The following untracked working tree files would be overwritten by checkout:\n%%s");
|
: _("The following untracked working tree files would be overwritten by checkout:\n%%s");
|
||||||
else if (!strcmp(cmd, "merge"))
|
else if (!strcmp(cmd, "merge"))
|
||||||
msg = advice_commit_before_merge
|
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||||
? _("The following untracked working tree files would be overwritten by merge:\n%%s"
|
? _("The following untracked working tree files would be overwritten by merge:\n%%s"
|
||||||
"Please move or remove them before you merge.")
|
"Please move or remove them before you merge.")
|
||||||
: _("The following untracked working tree files would be overwritten by merge:\n%%s");
|
: _("The following untracked working tree files would be overwritten by merge:\n%%s");
|
||||||
else
|
else
|
||||||
msg = advice_commit_before_merge
|
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
|
||||||
? _("The following untracked working tree files would be overwritten by %s:\n%%s"
|
? _("The following untracked working tree files would be overwritten by %s:\n%%s"
|
||||||
"Please move or remove them before you %s.")
|
"Please move or remove them before you %s.")
|
||||||
: _("The following untracked working tree files would be overwritten by %s:\n%%s");
|
: _("The following untracked working tree files would be overwritten by %s:\n%%s");
|
||||||
|
@ -787,7 +787,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
|
|||||||
|
|
||||||
dir_clear(&dir);
|
dir_clear(&dir);
|
||||||
|
|
||||||
if (advice_status_u_option)
|
if (advice_enabled(ADVICE_STATUS_U_OPTION))
|
||||||
s->untracked_in_ms = (getnanotime() - t_begin) / 1000000;
|
s->untracked_in_ms = (getnanotime() - t_begin) / 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1158,7 +1158,7 @@ static void wt_longstatus_print_tracking(struct wt_status *s)
|
|||||||
if (!format_tracking_info(branch, &sb, s->ahead_behind_flags))
|
if (!format_tracking_info(branch, &sb, s->ahead_behind_flags))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (advice_status_ahead_behind_warning &&
|
if (advice_enabled(ADVICE_STATUS_AHEAD_BEHIND_WARNING) &&
|
||||||
s->ahead_behind_flags == AHEAD_BEHIND_FULL) {
|
s->ahead_behind_flags == AHEAD_BEHIND_FULL) {
|
||||||
uint64_t t_delta_in_ms = (getnanotime() - t_begin) / 1000000;
|
uint64_t t_delta_in_ms = (getnanotime() - t_begin) / 1000000;
|
||||||
if (t_delta_in_ms > AB_DELAY_WARNING_IN_MS) {
|
if (t_delta_in_ms > AB_DELAY_WARNING_IN_MS) {
|
||||||
@ -1845,7 +1845,7 @@ static void wt_longstatus_print(struct wt_status *s)
|
|||||||
wt_longstatus_print_other(s, &s->untracked, _("Untracked files"), "add");
|
wt_longstatus_print_other(s, &s->untracked, _("Untracked files"), "add");
|
||||||
if (s->show_ignored_mode)
|
if (s->show_ignored_mode)
|
||||||
wt_longstatus_print_other(s, &s->ignored, _("Ignored files"), "add -f");
|
wt_longstatus_print_other(s, &s->ignored, _("Ignored files"), "add -f");
|
||||||
if (advice_status_u_option && 2000 < s->untracked_in_ms) {
|
if (advice_enabled(ADVICE_STATUS_U_OPTION) && 2000 < s->untracked_in_ms) {
|
||||||
status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
|
status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
|
||||||
status_printf_ln(s, GIT_COLOR_NORMAL,
|
status_printf_ln(s, GIT_COLOR_NORMAL,
|
||||||
_("It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
|
_("It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user