mirror of
https://github.com/git/git.git
synced 2026-02-25 17:33:34 +00:00
push: start warning upcoming default change for push.default
In preparation for flipping the default to the "upstream" mode from the "matching" mode that is the historical default, start warning users when they rely on unconfigured "git push" to default to the "matching" mode. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
42e52e358b
commit
5293b54a21
@@ -91,10 +91,35 @@ static void setup_push_upstream(struct remote *remote)
|
||||
add_refspec(refspec.buf);
|
||||
}
|
||||
|
||||
static char warn_unspecified_push_default_msg[] =
|
||||
N_("push.default is unset; its implicit value is changing in\n"
|
||||
"Git 2.0 from 'matching' to 'upstream'. To squelch this message\n"
|
||||
"and maintain the current behavior after the default changes, use:\n"
|
||||
"\n"
|
||||
" git config --global push.default matching\n"
|
||||
"\n"
|
||||
"To squelch this message and adopt the new behavior now, use:\n"
|
||||
"\n"
|
||||
" git config --global push.default upstream\n"
|
||||
"\n"
|
||||
"See 'git help config' and search for 'push.default' for further information.");
|
||||
|
||||
static void warn_unspecified_push_default_configuration(void)
|
||||
{
|
||||
static int warn_once;
|
||||
|
||||
if (warn_once++)
|
||||
return;
|
||||
warning("%s\n", _(warn_unspecified_push_default_msg));
|
||||
}
|
||||
|
||||
static void setup_default_push_refspecs(struct remote *remote)
|
||||
{
|
||||
switch (push_default) {
|
||||
default:
|
||||
case PUSH_DEFAULT_UNSPECIFIED:
|
||||
warn_unspecified_push_default_configuration();
|
||||
/* fallthru */
|
||||
case PUSH_DEFAULT_MATCHING:
|
||||
add_refspec(":");
|
||||
break;
|
||||
|
||||
3
cache.h
3
cache.h
@@ -625,7 +625,8 @@ enum push_default_type {
|
||||
PUSH_DEFAULT_NOTHING = 0,
|
||||
PUSH_DEFAULT_MATCHING,
|
||||
PUSH_DEFAULT_UPSTREAM,
|
||||
PUSH_DEFAULT_CURRENT
|
||||
PUSH_DEFAULT_CURRENT,
|
||||
PUSH_DEFAULT_UNSPECIFIED
|
||||
};
|
||||
|
||||
extern enum branch_track git_branch_track;
|
||||
|
||||
@@ -52,7 +52,7 @@ enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
|
||||
unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
|
||||
enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
|
||||
enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
|
||||
enum push_default_type push_default = PUSH_DEFAULT_MATCHING;
|
||||
enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
|
||||
#ifndef OBJECT_CREATION_MODE
|
||||
#define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user